jQuery - Set selected value of all dropdowns on page
Posted
by
Tgibson
on Stack Overflow
See other posts from Stack Overflow
or by Tgibson
Published on 2010-12-22T18:42:25Z
Indexed on
2010/12/22
18:54 UTC
Read the original article
Hit count: 114
Hello Frieds,
I have another jQuery question. For a user control with lots of database activity, I would like to use jQuery to set the selected values of all of the dropdowns to their "current" value. I want to do this to make the page appear to have finished the database call.
My jQuery skill is not the best, but I believe I need to use the pageLoad(). And since each dropdown is inside of a user control I can search for those dropdowns beginning with "usrControl"
$('select[id ^="usrControl"'].each(function(){
var selectedValue = $(this).val()
$(this).val(selectedValue)
});
Something like this is what I have in mind.
Thanks
© Stack Overflow or respective owner