I searched Stackoverflow and found lots of answers how I can show/hide a field on dropdown change by jQuery or simple inline js. But my problem is with using it inside a table.
For start let's keep it easy and use inline simple js instead of jQuery. I want if recaptcha is chosen then private and public key fields will be visible. I use a table, so the entire row should be hidden. and the rest of form should become upper to be immediately under select menu if those fields should be hidden to avoid gap between rows in table. But it doesn't work for row. and only the second field will be in/invisible because I added the style on field rather than on tr. (just for testing for first one I used it for tr and for second one I used for field to see what happens, but only second one works.) How to set it work for row removal and the rest of form will be upper to avoid two blank rows in form? Answer about how to fix it with jQuery instead of inline simple js is welcome too as my ultimate goal is to go with jQuery.
<tr class="something1">
<td class="left">Activate Captcha: </td>
<td class="right"><select name="activate_captcha" onchange="if (this.value=='recaptcha'){this.form['recaptcha'].style.visibility='visible'}else{this.form['recaptcha'].style.visibility='hidden'};">
<option value="none">None</option>
<option value="recaptcha">ReCaptcha</option>
</select>
</td>
</tr>
<tr class="something1" id="recaptcha" style="visibility:hidden;">
<td class="left">ReCaptcha Public Key: </td>
<td class="right"><input type="text" size="40" name="pub_key" value="" /></td>
</tr>
<tr class="something1">
<td class="left">ReCaptcha Private Key: </td>
<td class="right"><input type="text" id="recaptcha" style="visibility:hidden;" size="40" name="priv_key" value="" /></td>
</tr>
</tr>
<tr class="something1">
<td class="left">This row should come up under dropdown if rows above are invisible: </td>
<td class="right"><input type="text" value="" /></td>
</tr>