WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES
Advertisements

How to Set the Value of Input Text Box using jQuery

Topic: JavaScript / jQueryPrev|Next

Answer: Use the jQuery val() Method

You can simply use the jQuery val() method to set the value of an input text box.

Try out the following example to see how it actually works:

<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery Set Value of Input Text Box</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
    $("#myInput").val("https://");
});
</script>
</head>
<body>
    <label>Enter Website URL:</label>
    <input type="text" id="myInput">
</body>
</html>

Related FAQ

Here are some more FAQ related to this topic:

Advertisements
Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties