How to get input value using jQuery

jQuery is a lightweight JavaScript library that has simplified client-side webpage development by adopting a “write less, do more” ideology.

Whenever we need to take input from the user, we use the <input> tag. When using jQuery, we can also store the input value.

svg viewer

Library

You need to import this library for jQuery:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">

Code

In the code below, you will insert your name into the text-box and $().click() will be used to store it. This input will be saved and printed onto a web-page using the .html() function.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved