Displaying input when checkbox clicked |
Displaying input when checkbox clicked |
tudsy |
Dec 7 2022, 05:26 AM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
Hi
I am trying to display an input for an email address when a checkbox is clicked. <script> $.ajax('#email_consent', { type: 'get', dataType: 'html', success : function(html) { if ($('#email_consent:checked')){ $('#form').html( <label for='email'>Enter your Email address:</label> <input type='email' id='email' name='Email_Address' size='30' placeholder ='Your Email Address' required /> ); } }, error: function() { alert("Error"); } }); </script> #form is the id of the form (see attached) Attached File(s) form.txt ( 6.71k ) Number of downloads: 103 |
Lo-Fi Version | Time is now: 31st May 2024 - 11:19 PM |