0

I need to know if asp control (Button) is clicked or not using jQuery. This is button coding.

How can I pop up an alert box if someone hit a button using jQuery.

  <asp:Button ID="delete_checked_box_button_id"  OnClick="deletechecked_box_onclick" runat="server" Text="Delete Checked" />

Thanks in advance.

4 Answers 4

1

When you set the ClientIDMode property to Static you can use the Id you set:

$(document).ready(function() {
    $('#delete_checked_box_button_id').on('click', function(e) { 
        alert('Button clicked');
    });
}
Sign up to request clarification or add additional context in comments.

Comments

0
$('#<%=delete_checked_box_button_id.ClientID %>').click(function() {
  alert("Handler for .click() called.");
});

Comments

0

You don't need jQuery, you can use the button's property onClientClick

See this example in MSDN

Comments

0
<script type="text/javascript">
function BuyG2() {
        alert('Hai Jquery');
        }
</script>//jquery in sourse

 protected void Button1_Click(object sender, EventArgs e)
        {
 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>BuyG2();</script>", false);
}//ASP Button Click Event

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.