prop()
and html()
MethodsYou can simply use the jQuery prop()
method to change the text of the buttons built using the HTML <input>
element, whereas to change the text of the buttons which are created using the <button>
element you can use the html()
method.
The jQuery code in the following example will change the button text on document ready:
<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery Change Button Text</title>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(document).ready(function(){
// Change text of input button
$("#myInput").prop("value", "Input New Text");
// Change text of button element
$("#myButton").html("Button New Text");
});
</script>
</head>
<body>
<input type="button" id="myInput" value="Input Text">
<button type="button" id="myButton">Button Text</button>
</body>
</html>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel 8 Default Password Validation Rules
Password is the most important data in a...How to animate div height on mouse hover using jQuery
Use the jQuery animate() metho...Laravel 5.5 - Google reCaptcha Code With Validation Example
Today, we are share with you in this art...OnScroll Load More in Laravel 8 with Livewire Package
In this article, i will share with you h...How to Return Multiple Values from a Function in JavaScript
Return an Array of Values A function...