Powered by Blogger.

Set values in multiple select list using javascript and jQuery


Set values in multiple select lists using javascript and jQuery

We can make multiple options selected in our HTML form using JavaScript and jQuery.
In Javascript:
document.getElementById('elementId').value = ["optionVal1", "optionVal2", "optionVal3"];
and in Jquery It's pretty:
$("#elementId").val(["optionVal1", "optionVal2", "optionVal3"]);

No comments