tobya/jqueryselectedoption

Simple Combo box selected item chooser

Installs: 1 550

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 2

Open Issues: 0

Language:JavaScript

dev-master 2020-09-13 12:15 UTC

This package is auto-updated.

Last update: 2024-04-28 04:12:10 UTC


README

Allows all Select Form elements to specify an initial value as a 'data-SelectedOption' attribute on the select tag.

Note: Backward Comptatibility Break select attribute renamed to 'data-SelectedOption' instead of 'data_SelectedOption (dash instead of underbar) to match HTML5 custom attribute specifications (i.e. now the html will validate).

html

<select name="select"  data-SelectedOption="3">
  <option value="ERROR" data-noscriptitem>ERROR: If you see this an error has occured</option>
  <option value="1">Banana</option>
  <option value="2">Apple</option>
  <option value="3">Pear</option>
  <option value="4">Orange</option>
  
</select>

javascript

<script type="text/javascript">

  $('Document').ready(function(){
  
        $('Select').SelectedOption();
  
    });
</script>

Option 3 Pear will be selected.

Demo