I am attempting to hide and disable a DIV class (see code below) and I cannot for the life of me figure out what I am doing wrong.
The code below is actually suppose to hide a DIV of class "optional-field" unless you choose a certain option from the drop down form with select name of "productOptions[2]". This might be an odd "select name" but it is because it is dynamically created by PHP. But if you choose "Someone Else" it should "show()" that DIV. It should also hide it wheen page loads.
However, dispite that, I tried just doing a simple hide command of another div not dynamically created
Below is the code for both the function and then the HTML: NOTE: for the form select name, the HTML code shows the PHP place holder of <select name=\"productOptions[{VAL_OPTION_ID}]\"> but when created it is <select name=\"productOptions[2]\">
This should be how all of your stuff should look. Basically it shows that jQuery is to be loaded once the DOM is finished loading. Should solve your problem.
Thanks all for the input. It turned out to be that it didn't like where I had the <script>..../jQuery.js</script> put as far as order AND because I was also using the scriptaculous.js and prototype.js which were also causing conflict.
The code below is actually suppose to hide a DIV of class "optional-field" unless you choose a certain option from the drop down form with select name of "productOptions[2]". This might be an odd "select name" but it is because it is dynamically created by PHP. But if you choose "Someone Else" it should "show()" that DIV. It should also hide it wheen page loads.
However, dispite that, I tried just doing a simple hide command of another div not dynamically created
and I can't even get that to hide.
Below is the code for both the function and then the HTML:
NOTE: for the form select name, the HTML code shows the PHP place holder of
<select name=\"productOptions[{VAL_OPTION_ID}]\">
but when created it is
<select name=\"productOptions[2]\">
Javascript:
HTML
What am I missing?
This should be how all of your stuff should look. Basically it shows that jQuery is to be loaded once the DOM is finished loading. Should solve your problem.
Thanks,