Hiding HTML based on input field value (on load and on Keyup)
Hi guys,
I have the below jQuery which works regarding checking the data within an input field after keyup. This works. What I also need it to do is check on page load as well. So for example, if the value in this field is already 'Bob' then hide the relevant section of my page, alteratively, if it says 'Dave' show this section unless I then change this to Bob, in which case it should then hide it....
Hope this makes sence
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#NAME').keyup(function(){
if(jQuery(this).val() === 'Bob'|| jQuery.trim(jQuery(this).val()) ===
''){
jQuery('#hide2').slideUp("slow");
} else {
jQuery('#hide2').slideDown("slow");
}
});
});
</script>