- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10711 Articles for Web Development
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
919 Views
To enable and disable submit button, use the jQuery prop() method. You can try to run the following code to enable and disable submit button using jQuery −ExampleLive Demo $(document).ready(function() { $('#register').click(function() { $(this).prop('disabled',true); $("#content").show(); setTimeout(function(){ $('#register').prop('disabled', false); },3000); }); }); The above button disables for 3 seconds, on clicking.
![Bhanu Priya](https://www.tutorialspoint.com/assets/profiles/314653/profile/60_78287-1615027882.jpg)
10K+ Views
Generally, the forms in HTML uses a single submit button which saves the record when button is pressed. In some cases, we need a form with additional submit buttons such as "accept" or "reject". Those type of buttons usually attempt a state transition while updating the record. A form with multiple buttons has to process your server-side code needs to know which button was pressed. Generally, after submission the destination data is stored in the action attribute where every button leads to same location. To overcome this problem, we use formaction attribute. For each submit button we require a different ... Read More
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
2K+ Views
Yes, you can submit form with multiple submit buttons. Attack a custom click handler to all the buttons and the check which button is clicked.ExampleLive Demo $(document).ready(function(){ $("#myform button").click(function (ev) { ev.preventDefault() if ($(this).attr("value") == "button1") { alert("First Button is pressed - Form will submit") $("#myform").submit(); } if ($(this).attr("value") == "button2") { alert("Second button is pressed - Form did not submit") } }); }); First Button Second Button
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
1K+ Views
To create a div dynamically, use the html() method. You can try to run the following code to learn how to create a div dynamically on button click −ExampleLive Demo $(document).ready(function(){ $("button").click(function(){ $("body").html("This is a new div."); }); }); Create a new div This is demo text.
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/32020/profile/60_153038-1524898298.jpg)
533 Views
Here I am using one textarea and one button.The first textarea is used for user input then click the button and display the value in the alert box.Example Live Demo $(document).ready(function () { $("button").click(function () { var dim = $("#txt").val(); alert(dim); }); }); Click Here
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
288 Views
To know which key was pressed in a form input using jQuery, use the jQuery keydown event. You can try to run the following code to learn how to detect key pressed in a form input −ExampleLive Demo $(document).ready(function(){ $('#myinput').keydown(function(e) { var newkey = 'Key code = ' + e.which + ' ' + (e.ctrlKey ? 'Ctrl' : '') + ' ' + (e.shiftKey ? 'Shift' : '') + ' ' + (e.altKey ? 'Alt' : ''); $('#mykey').text(newkey); return false; }); }); Press any key: The key you press is visible here with keycode.
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
291 Views
To detect pressing Enter on keyboard, use the keup() function with keyCode. You can try to run the following code to learn how to detect pressing Enter on keyboard using jQuery −ExampleLive Demo $(document).ready(function(){ $('textarea').bind("enterKey",function(e){ alert("You have pressed Enter key!"); }); $('textarea').keyup(function(e){ if(e.keyCode == 13) { $(this).trigger("enterKey"); } }); }); Press Enter below Press Enter below
![Kristi Castro](https://www.tutorialspoint.com/assets/profiles/44730/profile/60_19515-1530624995.png)
11K+ Views
To validate email using jQuery, use the regex pattern. You can try to run the following code to learn how to validate email using jQuery −ExampleLive Demo $(document).ready(function() { $('.error').hide(); $('#submit').click(function(){ var name = $('#name').val(); var email = $('#email').val(); if(name== ''){ $('#name').next().show(); return false; } if(email== ''){ ... Read More