I want to have jQuery show div id=\'business\' only if \'business use\' is selected in the dropdown box.
This is my code:
Wrap the code within $(document).ready(function(){...........}); handler , also remove the ; after if
$(document).ready(function(){
$('#purpose').on('change', function() {
if ( this.value == '1')
//.....................^.......
{
$("#business").show();
}
else
{
$("#business").hide();
}
});
});
Fiddle Demo