JavaScript Manually click a child link (and navigate) when clicking parent [duplicate]

there is no event handler attached using jQuery's event system that corresponds to these events

This means, at this point of the learning material, no jQuery event handlers has been attached to these elements using .click(function() {} or .bind('click', function () {}), etc.

The no-argument .click() is used to trigger (.trigger('click')) a "click" event from jQuery's perspective, which will execute all "click" event handlers registered by jQuery using .click, .bind, .on, etc. This pseudo event won't be sent to the browser.

.trigger()

Execute all handlers and behaviors attached to the matched elements for the given event type.

Check the updated jsFiddle example, click on the two links to see the difference. Hope it helps.

Answer:1

i think you forgot to read documentation.

Document says :

// Triggering a native browser event using the simulate plugin
$( ".js-a2" ).simulate( "click" );
Answer:2

Old question, but here's a nifty and simple solution: You can basically "register" a native JS event with jQuery by assigning the DOM element's onEvent handler to be the native event. Ideally, we would check first to ensure the onEvent handler has not already been set.
For example, 'register' the native JS click event so it will be triggered by jQuery:

$('.js-a1').click(function (e) {
  $('.js-a2').click();
  e.preventDefault();
});

var trigger_element = $('.js-a2')[0]; // native DOM element
if (!trigger_element.onclick) {
  trigger_element.onclick = trigger_element.click;
}

Here is a fiddle: http://jsfiddle.net/f9vkd/162/

Answer:3

I've got some code that sends an ajax request when a form is being submitted. This works the first time the form is submitted (it's a search module), but only once. I've added an effect to highlight ...

I've got some code that sends an ajax request when a form is being submitted. This works the first time the form is submitted (it's a search module), but only once. I've added an effect to highlight ...

  1. response from ajax call
  2. response from ajax
  3. response from ajax post
  4. return response from ajax call
  5. get response from ajax
  6. get response from ajax call jquery
  7. get response from ajax post
  8. get response from ajax call
  9. get response from ajax jquery
  10. download response from ajax
  11. get response from ajax request
  12. get response from ajax javascript
  13. return response from ajax
  14. ajax call without response
  15. get response from ajax call javascript
  16. no response from ajax jquery
  17. alert response from ajax
  18. response.redirect from ajax call
  19. json response from ajax call
  20. return response from ajax success

I'm replacing the smiley shortcuts from my text editor with img tags, but the logic I use also sees parts of links and tags as smiley shortcuts (e.g. :/ in http://, or :p in cursor:pointer in the ...

I'm replacing the smiley shortcuts from my text editor with img tags, but the logic I use also sees parts of links and tags as smiley shortcuts (e.g. :/ in http://, or :p in cursor:pointer in the ...

Here is my angular js app with html code <html> <head> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <...

Here is my angular js app with html code <html> <head> <title></title> <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <...

function handleCheckBoxEvent(cb){ var index = 0; switch (cb.id){ case "cb0": index = 0; alert(cb.id); break; ...

function handleCheckBoxEvent(cb){ var index = 0; switch (cb.id){ case "cb0": index = 0; alert(cb.id); break; ...

  1. switch checkbox
  2. switch checkbox value
  3. checkboxes switch android
  4. switch checkbox php
  5. ajax switch checkbox