- I have two input fields that need to hide when first visit.
- There will be a button to toggle it to show the fields so it could be edited.
- The appending word (i.e. _temp) with the id is just to change the id name so that it doesn't save over again if it's not necessary. When the fields are showing the append word (_temp) needs to be removed. (i.e. (Original Id Name: payment_gateway_login) (Append Id Name: payment_gateway_login_temp), when fields are showing remove append id name so it should be back to original: payment_gateway_login, the same should follow with id="payment_gateway_password".
- Below is as far as I can get. Any help would be greatly appreciated.
HTML:
<ul>
<li class="show-hide-container hide" style="display: list-item; ">
<ol>
<li class="password input required stringish" id="payment_gateway_login_input">
<input id="payment_gateway_login" name="payment_gateway[login]" type="password">
</li>
<li class="password input required stringish" id="payment_gateway_password_input">
<input id="payment_gateway_password" name="payment_gateway[password]" type="password">
</li>
</ol>
</li>
<li class="clearfix edit-login-pass"> <a href="#" class="btn" id="show_hide">Edit Login & Password</a>
</li>
</ul>
JQUERY:
$("input#payment_gateway_login").attr("id", "payment_gateway_login" + "_temp");
$("input#payment_gateway_password").attr("id", "payment_gateway_password" + "_temp");
$("#show_hide").live("click", function(event) {
return $("li.show-hide-container").toggle("show");
});