Forums » .NET » JavaScript »

How to check if a button is clicked using JavaScript?


Posted Date: 07 Feb 2013      Posted By:: ARUNRAJ Profile photo    Member Level: Silver  Member Rank: 0     Points: 2   Responses: 1

Friends,

I have two Submit in an asp page for two different client side operation. How can I check which one is clicked by the client using JavaScript.
and Also I want to pass that value to server side for comparison..






Regards
ArunRaj



Are you looking way to check a button click using JavaSript? Do you want to pass values from JavaSript to server side? Read this thread to know about how to use JavaSript for checking whether a button is clicked.

Responses

#703808    Author: Arvind kumar      Member Level: Gold      Member Rank: 37     Date: 07/Feb/2013   Rating: 2 out of 52 out of 5     Points: 3

Simply you can attach a javascript function in button's click event so once that is clicked that js function will be called and you show messages within that js

eg
in your code
btnUpdate.Attributes.Add("onclick", "buttonClicked()");

In javascript code file
funciton buttonClicked()
{
alert('Button's click event fired');
}

Also you can add click event directly as follows
document.getElementById('button').onclick = function() {
alert("button was clicked");
}?;

Regards & thanks
Arvind kumar
Visit--blog.akumars.esoftera.in


 
Post Reply     

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.





  • Return to Discussion Forum
  • Start new thread


  • Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Prasanth.R
    More...
     
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India

    
    
    
    

    Click the "Follow" button above to follow Tony John