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
});
Related Contents:
- Direct vs. Delegated – jQuery .on()
- jQuery.click() vs onClick
- Check if an image is loaded (no errors) with jQuery
- How to distinguish between left and right mouse click with jQuery
- jQuery $(document).ready and UpdatePanels?
- jQuery scroll() detect when user stops scrolling
- How to debug JavaScript / jQuery event bindings with Firebug or similar tools?
- Can I find events bound on an element with jQuery?
- jQuery click events firing multiple times
- How to wait for the ‘end’ of ‘resize’ event and only then perform an action?
- How can I detect pressing Enter on the keyboard using jQuery?
- Getting value of select (dropdown) before change
- Long Press in JavaScript?
- Event when user stops scrolling
- Using jQuery to test if an input has focus
- How to fire an event on class change using jQuery?
- Check if event exists on element [duplicate]
- How to detect online/offline event cross-browser?
- How to differentiate single click event and double click event?
- jQuery pass more parameters into callback
- How to detect escape key press with pure JS or jQuery?
- Detect multiple keys on single keypress event in jQuery
- Fire jQuery event on div change
- How to trigger jQuery change event in code
- Alternative to jQuery’s .toggle() method that supports eventData?
- How to bind Events on Ajax loaded Content?
- How to stop events bubbling in jQuery? [duplicate]
- Attaching click event to a JQuery object not yet added to the DOM [duplicate]
- Wait till a Function with animations is finished until running another Function
- How to stop default link click behavior with jQuery
- When should I use return false in jquery function?
- HTML5 dragleave fired when hovering a child element
- Variables set during $.getJSON function only accessible within function
- Detect Close windows event by jQuery
- window.resize event firing in Internet Explorer
- jQuery $(document).ready () fires twice
- How can I get jQuery .val() AFTER keypress event?
- Callback function example
- Why “$().ready(handler)” is not recommended?
- Open Select using Javascript/jQuery?
- Why is ‘event’ available globally in Chrome but not Firefox?
- Waiting on multiple asynchronous calls to complete before continuing
- Get the clicked object that triggered jquery blur() event [duplicate]
- Fullscreen API: Which events are fired?
- Drop event not firing in chrome
- Can you have a JavaScript hook trigger after a DOM element’s style object changes?
- Can you wait for javascript callback?
- Disabling middle click scrolling with javascript
- Detect focus initiated by tab key?
- Catch scrolling event on overflow:hidden element