franko75 0 Newbie Poster

Hi, I've posted once or twice before on a similar issue and couldn't ever get it resolved, but I have narrowed it down a bit and set up a demo which will hopefully help someone spot what is going on.

To recreate the problem, go to http://maguiresonline.co.uk/development/dropdown_issue/, select Client3 from the top dropdown list - this then uses AJAX to populate the second dropdown with a list of options specific to that client. The problem I have, however, is that if you select one of the jobs in the second dropdown, then click Filter, the selected job reverts back to the top one in the list, but I want to have that option still selected following the page refresh.

For some reason the following line is working perfectly when I run it from the console in firebug:

$('#job_id > OPTION[value=5224]' ).attr('selected', true);

But when i try to wrap it within the rest of my js to be executed on document.ready, the dropdown list selection keeps reverting to the first option. The select-chain.js script is loaded before i execute the above line of code, and I thought that the fact that the line above is wrapped in document.ready should allow the select-chain.js code to load first, then I could simply update the currently selected option in the dropdown. I'm not sure why this is working from the console and not within my code, any ideas?