I have a piece of javascript code that causes a text box to appear adjacent to a drop-down menu when a certain selection is made. It worked perfectly until I embedded it in html. I’m not sure why it’s not working now, although it’s probably really trivial.
Here is the function, as it is now:
$public->html .= '<script type="text/javascript">;
$(function(){
// initially check the default value in dd_question
if($("#dd_question").find("option:selected").val() == "0"){
$("#other_question").show();
}else{
$("#other_question").hide();
}
$("#dd_question").change(function() {
if($(this).find("option:selected").val() == "0"){
$("#other_question").show();
}else{
$("#other_question").hide();
}
});
});
</script>';
It would be great to have this working again. Can anyone see why it’s not?
I’m not php user but i can tell you that the semi colon at this line probably shouldn’t be there.