1. Load a page
2. Use an ajax call and jQuery to populate a select (verified that the value 
I'm seeking is loaded)

3. Using a passed parameter (stored in a hidden field), set the proper option 
to selected (and this code could be optimized, before anyone mentions it)


I've done this many times and it works.

This time it doesn't. If I put in an alert (originally done to make sure the 
value I want is really there), then it works. Without the alert, it doesn't.

var x = $('#TheBldg').val();  // storage of passed parameter
alert(x);
if ( x.length > 0 ) { $('#bldgID').val(x).prop('selected',true); }

In this case I suspect it's a timing issue. Populating the select adds ~800 
options. That's a lot and there are ways I could cut that down, but right now 
it's 800.

Could it be that something isn't getting updated because of so many options so 
my code to set the selected index runs too soon without the alert to slow 
things down?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355810
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to