Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Introduction:

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.

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 RSS subscribe by email Subscribe by Email

2 comments :

Shahabuddin shahab said...

Hello Sir Please post any project on converting Number to word (11:20 hr to eleven twenty hours ).

Anonymous said...

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

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.