sreenu sreenu - 8 months ago 43
jQuery Question

How to set value in dropdown using Jquery?

Hi I am setting a value in a drop down using jquery in the following ways.

$("#dropDownItems option[value='--Select--']").attr('selected', 'true');

$("#dropDownItems option[value='--Select--']").attr('selected', 'selected');

But none of these are working for FireFox! and is working fine for remaining browsers.

Can any one help me out?


This should do the trick for you.

$('#dropdownID').val("Value to be selected");