How to set value of input text using jQuery?

Today, We want to share with you jquery set input value.In this post we will show you jquery set textbox value dynamically, hear for jquery sets value of hidden field we will give you demo and example for implement.In this post, we will learn about how to get input value in jquery? with an example.

jQuery text(), html(), and val() – Set content Examples

Example 1: index.html

<!DOCTYPE html>
<script src=""></script>
    $("#content1").text("Hello world!");
    $("#content2").html("<b>Hello world!</b>");
    $("#content3").val("Dolly Duck");

<p id="content1">Tamil Rockers.</p>
<p id="content2">TamilRockers is a public torrent website. TamilRockers website uploads the pirated versions of Tamil, Telugu, Hindi, English</p>

<p>Input field: <input type="text" id="content3" value="Mickey Mouse"></p>

<button id="submitbutton1">Set Text Data</button>
<button id="submitbutton2">Set HTML Data</button>
<button id="submitbutton3">Set Value Data</button>


Access the input inside the div with this selector:

Read Also:  Create dynamic calendar using jQuery, Ajax and PHP

$(function () {
  $('.content input').val("pakainfo");

Select by input name:


Select by input class:


Select by input id:


Other Way

$(document).ready(function () {

    $('.content > input').val("TamilRockers");


I hope you get an idea about jquery input value get.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  how to get input value in jquery?

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Simple Laravel Form Validation Example
  2. Read Also:  Check Uncheck All Checkboxes using jQuery Selectors
  3. Read Also:  Simple jQuery Fade Effects Example
  4. Read Also:  select all checkbox jquery
  5. Read Also:  jquery next sibling with class
  6. Read Also:  Bootstrap Modal popup multiple File Upload using AJAX
  7. Read Also:  Laravel Custom Dropdown Server Side Filter in Datatables
  8. Read Also:  javascript export to excel | download HTML Table Data to Excel file
  9. Read Also:  jQuery Delete Multiple Rows using checkbox PHP with MySQL
  10. Read Also:  Create dynamic calendar using jQuery, Ajax and PHP