Introduction:
Here I will explain how to change button text dynamically in jQuery or jQuery change button text on click dynamically.
Here I will explain how to change button text dynamically in jQuery or jQuery change button text on click dynamically.
Description:
In previous articles I explained jQuery slide div from left to right or right to left, jQuery cascading dropdownlist example in asp.net, jQuery hide div after 5 seconds, jQuery change default text selection color with css and many articles relating to css, jQuery, JavaScript, Asp.net, SQL server. Now I will explain how to change button text dynamically in jQuery.
In previous articles I explained jQuery slide div from left to right or right to left, jQuery cascading dropdownlist example in asp.net, jQuery hide div after 5 seconds, jQuery change default text selection color with css and many articles relating to css, jQuery, JavaScript, Asp.net, SQL server. Now I will explain how to change button text dynamically in jQuery.
To change button text
dynamically we need to write the code like as shown below
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Change Button
Text Dynamically</title>
<script type="text/javascript"
src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(function () {
$('#btnclick').click(function () {
var txt = $('#btnclick').val()
if (txt == 'Show
Password') {
$(this).val('Hide Password');
return false;
}
else if (txt == 'Hide
Password') {
$(this).val('Show Password');
return false;
}
});
})
</script>
</head>
<body>
<form id="form1">
<div>
<input type="button"
id="btnclick"
value="Show
Password" />
</div>
</form>
</body>
</html>
|
Once we run above query we will get output like as
shown below
Live Demo
To check live demo click on below button
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
Subscribe by RSS
Subscribe by Email
2 comments :
Hello Sir Please post any project on converting Number to word (11:20 hr to eleven twenty hours ).
Hi Suresh,
I want tutorial on;when I click button it has process to upload excel data in sql, put some validation and then process those records. So, I want to show user loading process with message on each stage 1 data upload start. 2 data validating 3 auromach started. It is in one button click written.
how to display 3 message on one button click. I used update panel in asp.net
Note: Only a member of this blog may post a comment.