Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all, i have a css class for a button in my .aspx page,i want to change cssclass for the button when it is clicked

C#
.btnmbl1
{
	font-weight: bold;
	font-size: 15px;
	color: Black;
	font-family: Calibri;
	width: 100px;
	height: 70px;
	border-style: none;
	background-image: url(../images/Button_Mobile_R2.gif);
}
.btnmbl1:focus, .btnmbl1:hover
{
	background-image: url(../images/Button_Mobile_R2_1.gif);
}
Posted

check this fiddle [^]
check the above fiddle. You will get the solution I hope.
Thanks
:)
 
Share this answer
 
Comments
Member 10924493 26-Sep-14 0:38am    
Thanks for the Answer ,but My application not working with JQuery Plz Give it in Plain Java Script,even i don't know how to do it Thanks
Hope you you will get answer for your question here:
http://stackoverflow.com/questions/21739528/change-css-style-on-button-click[^]

Thanks.
 
Share this answer
 
v2
JavaScript
$("button").click(function(){
  $("h1,h2,p").addClass("blue");
  $("div").addClass("important");
});


Helping link
http://www.w3schools.com/jquery/jquery_css_classes.asp[^]

http://api.jquery.com/css/[^]
 
Share this answer
 
you can do this by using

1. Jqury
2.from Code Behind when the button is clicked(btn_Click event)

Sol1.
C#
you already got it [Solution by MuhammadUSman1]



Soln 2

C#
by using.

button.attribute.add("cssclass","class Name")
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900