Jquery - Javascript DHTML - Developer Resourses - Creating Select Dropdown List Options dynamically with Jquery ::: Lionfish Tehcnologies



Home / Developers Resourses / Tips

Creating Select Dropdown List Options dynamically with Jquery

// TO CLEAN THE DDL
$('#ddStates').empty();

// TO ADD OPTIONS
$('#ddStates').append($('<option></option>').val('FL').html('Florida'));
Or
$('#ddStates').append($('<option selected></option>').val('FL').html('Florida'));

With Val() you specify the Value of the option.
Wint Html() you specify the Text of the option.




Lionfish Technologies ® 2009 All rights reserved