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.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved