HOW TO SET JQUERY COMBO BOX AS SELECTED TRUE

E E Cummings

Total Post:26

Points:182
Posted by  E E Cummings
JSON 
 1292  View(s)
Ratings:
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.
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: how to set jquery combo box as selected true

    Hi,


    Try this,

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!