Solved

button click

Posted on 2011-03-05
4
327 Views
Last Modified: 2012-06-27
Are there any differences between "button" and "input" for the click event?
My click event is not firing.
 
                  <button id="ctl00_ContentPlaceHolder1_btnSubmitOrder" class="btn">
                        <span></span>Submit Order</button>


                $("[id$='_btnSubmitOrder']").click(function () {
                    if (validateNotes) {
                        return true;
                    }
                    else {
                        return false;
                    }
                });
0
Comment
Question by:JRockFL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:BurnieP
ID: 35044543
Hi,

I don't think i've ever use the button control. But with input I would do it like this :

The way I would select a button like you are trying to is :

<input type="button" id="ctl00_ContentPlaceHolder1_btnSubmitOrder" class="btn" value="Submit Order"></input>

$("input[id*=_btnSubmitOrder]").click(function() {
  if (validateNotes) {
          return true;
      }
      else {
          return false;
      }
});
0
 
LVL 8

Author Comment

by:JRockFL
ID: 35044552
This is the first time I'm using the button control and I dont have the option of changing to input.
0
 
LVL 16

Accepted Solution

by:
BurnieP earned 500 total points
ID: 35044563
Ok,

Then try using this :

 $("button[id*=_btnSubmitOrder]").click(function () {
     if (validateNotes) {
        return true;
     }
    else {
        return false;
    }
});
0
 
LVL 8

Author Closing Comment

by:JRockFL
ID: 35044620
Cool, that did it!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question