Codelab Editor
Free Online HTML Editor
Run
Learn jQuery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery Get Input Value</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: #f4f4f4; } h2 { color: #333; } label { display: block; margin-bottom: 8px; font-weight: bold; } input[type="text"] { padding: 10px; width: 300px; border: 1px solid #ccc; border-radius: 4px; } button { margin-top: 15px; padding: 10px 15px; border: none; background: #1976d2; color: white; cursor: pointer; border-radius: 4px; } #output { margin-top: 20px; padding: 10px; background: #e3f2fd; border-left: 4px solid #1976d2; white-space: pre-wrap; } </style> </head> <body> <h2>Get Input Field Value Using jQuery</h2> <p>This example shows how to retrieve the value entered into a text input (Username field) using the <code>.val()</code> method in jQuery.</p> <label for="username">Username</label> <input type="text" id="username" placeholder="Enter your username"> <button id="getUsername">Get Username</button> <div id="output"></div> <script> $(document).ready(function(){ $("#getUsername").click(function(){ var userName = $("#username").val(); $("#output").text("Username: " + userName); }); }); </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