javascript - How to hide and show a label and its field prior to and after a selection from a selection list -
i creating form allows customer input order details. payment method in selection list has 3 options. if option selected credit or debit card user have input card number. problem want card number label , field hidden until user makes selection. can please tell me how this?
this should trick.
<!doctype html> <html> <head> <scirpt src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </head> <script type="text/javascript"> $(document).ready(function() { $('input').keypress(function() { $('input').css('visibility','visible'); }) }); </script> <body> <form> <input type="text" name="credit-card" placeholder='####-####-####-####'> <input type="text" style="visibility:hidden;" name="name-on-card"> <input type="date" style="visibility:hidden;" name="date-on-card"> </form> </body> </html>
Comments
Post a Comment