Obtains the option value of the drop-down list box, the operation of the list box, and the option of the list box.
Obtain the value in option:
<Script type = "text/javascript">
Var myselect = $ ("# test option"). length;
Alert (myselect );
For (var I = 0; I <myselect; I ++)
{
Alert ($ ("# test option"). get (I). value );
}
</Script>
Set the background value to the default value in option.
(1)
<Script type = "text/javascript">
Var myselect = $ ("# test option"). length;
Alert (myselect );
For (var I = 0; I <myselect; I ++)
{
If ($ ("# test option"). get (I). value = '2 ')
{
$ ("# Test option"). get (I). attr ("selected", "selected ");
}
}
</Script>
(2)
Var selectlength = $ ("# type option"). length;
Alert (selectlength );
For (var I = 0; I <selectlength; I ++)
{
Alert ($ ("# type option"). get (I). value );
If ($ ("# type option "). get (I ). value = d. TYPE_ID) // compare the value of option with the value in json. If the value is equal, set this value to the default value.
{
// Var select = document. getElementById ("type ");
// Alert (sel. options [select. selectedIndex]. text );
// Var aa = $ ("# type option"). get (I );
// $ ("# Type option [value = '" + d. TYPE_ID + "']"). attr ('selected', true );
// Alert ("selected" + $ ("# type"). find ("option: selected"). text ());
$ ('# Type'). combobox ('select', d. TYPE_ID); // set the display value for the list in easyUI
}
}