Home > DeveloperSection > Forums > how to set jquery combo box as selected true
E E Cummings
E E Cummings

Total Post:26

Points:182
Posted on    June-20-2013 3:21 AM

 JSON JSON 
Ratings:


 1 Reply(s)
 975  View(s)
Rate this:
Hi Expert,

I have a jquery combo box whose selected value I am storing in a session.

After I retrieve the value from the session(which contains Json data) I want to again make the combobox to be selected for the same value, i am trying to do something like this but does not seem to work.

var myArrayVar=JSON.parse(document.getElementById("populateDT").innerHTML);
alert(myArrayVar[0].ActionMessage);
if(myArrayVar[0].ActionMesssage == "Error Message")
{
            document.getElementById("combobox").value="error";
            document.getElementById("combobox").selected=true;
 }


Any help on above is really appreciated.


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-20-2013 7:39 AM

Hi,

Try this,

document.getElementById('sel').value = 'saab'; // your value here


Don't want to miss updates? Please click the below button!

Follow MindStick