Hi I am trying to hide a form element unless a particular dropdown value is selected; here is my code so far, however it is not working?
<script type="text/javascript">
$(document).ready(function() {
$('txt_ccode').change(function() {
if ($(this).val() == 'GB') {
document.getElementById('txt_postcode').style.display="block";
}
else {document.getElementById('txt_postcode').style.display="none"; }
});
});
</script>
Any help is appreciated
Now that you are using jQuery, the inner show and hide logic and be simplified like this: