Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery: Fire click on event on a span

I saw a post earlier today and have been playing around with: http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html

What I'd like to be able to do is when a span gets clicked, to fire the click event on a different element in the page:

<div class='editable sampleItem pointer' id='qqq'>click me!!!</div>

Is that possible?

like image 854
NinjaCat Avatar asked Aug 28 '10 09:08

NinjaCat


1 Answers

sure..

$('.myspan').click(function(){
   $('.different-div').click();
})

$('.different-div').click(function(){alert('div click fired')});
like image 112
Moin Zaman Avatar answered Nov 16 '22 01:11

Moin Zaman