Sunday, 15 May 2011

javascript - trigger click and chain the click behavior -



javascript - trigger click and chain the click behavior -

i need emulate auto-click on matching elements (links) wan add together click behavior logic right there on same line, possible? below alert("my click behavior");

instead of following:

jq('tbody[groupstring^=";#emergency;#"] a').click(function(){ jq(this).parent().parent().parent().next().find('td:contains("emergency")').each(function(){ jq(this).html(jq(this).html().replace(/emergency/g,"urgent")); }); })

i want chain above click behavior straight below:

jq('tbody[groupstring^=";#emergency;#"] a').each(function(){ jq(this).trigger('click').my click behavior(); })

this how define click behavior

jq('tbody[groupstring^=";#emergency;#"] a').each(function(){ jq(this).click(function() { //what should happen on click }); })

this how can define same click behavior many elements:

jq('tbody[groupstring^=";#emergency;#"] a').click(function() { //what should happen on click });

this how trigger click:

$(myselector).click();

javascript jquery javascript-events event-handling

No comments:

Post a Comment