So, here’s the problem. I wrote a code that opens a div based on the selected dropdown. That works great. I then wanted to preselect a specific option ($_POST[‘value’]). That works great. The problem comes in when I also want to have the correlating div to open as well. I can do one or the other, but never both together. Notice that I included the working option and commented it out. Please show me what I’m supposed to do:
$(document).ready(function(){
$('.box').hide();
$('#sow').change(function() {
$('.box').hide();
$('#div' + $(this).val()).show();
});
});
var theText = "Printer Setup";
//$("#sow option:contains(" + theText + ")").attr('selected', 'selected');
//$("#sow option:contains(" + theText + ")")$('#divoption5').show();
$("#sow option:contains(" + theText + ")").attr('selected', 'selected')$('#divoption5').show();
Try using
end()– http://jsfiddle.net/YRJLY/