Completely Free .NET word API

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


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..


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.


#703808    Author: Arvind kumar      Member Level: Gold      Member Rank: 0     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

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

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

    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India