sreenu sreenu - 1 month ago 4
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?

Answer

This should do the trick for you.

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