In the jquery below, the two custom fields (customfield_13272, customfield_13273) are select lists which are only populated after the customfield_13271 select list is changed.
I'm trying to assign the selected option of the two custom fields, to be the first element in the list which is not the default "Select an item" option.
The problem, in addition to the fact that the selected option of those fields are not changing, is that when I attempt to alert the value of one of those options, it returns undefined.
Do I simply need to add a delay() function to allow the custom field options to populate or am I missing something else?
BTW, my jQuery css directive IS working fine.
<script type="text/javascript">
jQuery.noConflict()
jQuery(document).ready(function()
{
jQuery('#customfield_13271').change(
function()
{
jQuery('#customfield_13272,#customfield_13273').css('border','4px solid orange');
jQuery('#customfield_13272 option').first().next().attr('selected','selected');
jQuery('#customfield_13273 option').first().next().attr('selected','selected');
alert(jQuery('#customfield_13272 option').first().next().val());//THIS RETURNS UNDEFINED
});
});
</script>