Click here to Skip to main content
15,937,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is webform1 code where i call a javascript function on button click

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="valid_try2.WebForm1" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
<script type="text/javascript" src="JavaScript1.js"></script>

<form id="form1" runat="server">

<button id="btn" class="xx" name="btn" onclick="abc()">Button</button>


This is stylesheet file for css
.xx {
border: 5px solid green;

.yy {
border: 5px solid red;

This is javascript file

function abc() {

What I have tried:

i want to change the class after button click but i am not do this plz help me kindly
Updated 15-Oct-16 22:56pm

1 solution


The best way is ti using Javascript / jQuery:

  $('#Your_Button_ID').on('click', function(){

for useful examples please see:


Best Regards
Share this answer
Ali Majed HA 16-Oct-16 5:09am    
Please have a look at 3rd Link. It has been using
Ali Majed HA 16-Oct-16 5:11am    
I am not well trained in server-side languages and technologies like
sorry if it does not work
Member 12107284 16-Oct-16 5:46am    
sir i add this but change was not remain continues ...little time apply and again change to firstclass
Member 12107284 16-Oct-16 5:47am    
bundle of thanks
Ali Majed HA 16-Oct-16 6:27am    
If it works, would you please accept and vote answer? Thanks

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