Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Get Multiple Form Values</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <style> body { font-family: Arial, sans-serif; padding: 30px; background: #f9f9f9; } h2 { color: #222; } label { display: block; margin-top: 15px; font-weight: bold; } input, select { padding: 8px; width: 300px; margin-top: 5px; border: 1px solid #ccc; border-radius: 4px; } button { display: block; margin-top: 20px; padding: 10px 20px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; } table { margin-top: 30px; border-collapse: collapse; width: 100%; max-width: 600px; } th, td { text-align: left; padding: 10px; border: 1px solid #ccc; } th { background-color: #e0f2f1; } </style> </head> <body> <h2>Get Multiple Form Values with jQuery</h2> <p>This example gets the values of Username, Email, and City fields and displays them inside a table using <code>.val()</code>.</p> <label for="username">Username</label> <input type="text" id="username" placeholder="Enter your username"> <label for="email">Email</label> <input type="text" id="email" placeholder="Enter your email"> <label for="city">City</label> <select id="city"> <option value="">Select your city</option> <option value="New York">New York</option> <option value="London">London</option> <option value="Delhi">Delhi</option> <option value="Tokyo">Tokyo</option> </select> <button id="submitBtn">Show Info</button> <table id="resultTable" style="display: none;"> <thead> <tr> <th>Field</th> <th>Value</th> </tr> </thead> <tbody> <tr> <td>Username</td> <td id="showUsername"></td> </tr> <tr> <td>Email</td> <td id="showEmail"></td> </tr> <tr> <td>City</td> <td id="showCity"></td> </tr> </tbody> </table> <script> $(document).ready(function(){ $("#submitBtn").click(function(){ var username = $("#username").val(); var email = $("#email").val(); var city = $("#city").val(); $("#showUsername").text(username); $("#showEmail").text(email); $("#showCity").text(city); $("#resultTable").show(); }); }); </script> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console