You can’t set a click
handler on an element that doesn’t exist. What you should do is use .on
to bind a element further up the tree. Something like:
$("#someparentelement").on("click", "#yes", function() {
// your code
});
More Related Contents:
- Javascript: function doesnt work even though condition is met (hard for me to explain)
- Direct vs. Delegated – jQuery .on()
- How to distinguish between left and right mouse click with jQuery
- jQuery $(document).ready and UpdatePanels?
- How to debug JavaScript / jQuery event bindings with Firebug or similar tools?
- Can I find events bound on an element with jQuery?
- Getting value of select (dropdown) before change
- How can I detect pressing Enter on the keyboard using jQuery?
- What is the difference between the mouseover and mouseenter events?
- How to fire an event on class change using jQuery?
- Long Press in JavaScript?
- Event when user stops scrolling
- jQuery scroll() detect when user stops scrolling
- Fire jQuery event on div change
- Alternative to jQuery’s .toggle() method that supports eventData?
- How to stop events bubbling in jQuery? [duplicate]
- Attaching click event to a JQuery object not yet added to the DOM [duplicate]
- How to stop default link click behavior with jQuery
- Variables set during $.getJSON function only accessible within function
- Why “$().ready(handler)” is not recommended?
- How to detect if the user clicked the “back” button
- Open Select using Javascript/jQuery?
- Converting a recursive function into an asynchronous CPS implementation (javascript)
- Can you wait for javascript callback?
- Prevent firing focus event when clicking on div
- Bind events on dynamic created elements inserted by AJAX (check box)
- Catch scrolling event on overflow:hidden element
- Trigger for span text/html on changed
- jQuery .on() method doesn’t see new elements
- Cancel click event in the mouseup event handler