I have another (probably simple) Jquery question. I just want to display the selected value of a dropdown list using Jquery. I have saved the selected value to a database and now just need it to be displayed when the user comes back to the page. I have tried every method I can think of (and google’s search results!) but it doesn’t work. I must be missing something simple (again) please help! I have tried the following:
$(document).ready(function() {
$("quantity").val('2');
$("quantity").text('2');
$("quantity .ui-btn-text").text('2');
$("quantity").filter(function() {
return $(this).text() == '2';
}).attr('selected', true);
}
and here is a JSfiddle: http://jsfiddle.net/zv58e/
Help!
Thanks
Dan
should
Demo
Or