JQuery: fire click event on span

I saw the message earlier today and played with: http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html

What I would like to do is when a click is clicked to fire the click event on another page element:

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

Is it possible?

+6
javascript jquery
source share
2 answers

for sure ..

 $('.myspan').click(function(){ $('.different-div').click(); }) $('.different-div').click(function(){alert('div click fired')}); 
+18
source share

Check how it is,

HTML:

 <div class='editable sampleItem pointer' id='qqq' onclick='clickHandler()'>click me!!!</div> 

JavaScript:

 <script type="text/javascript"> function clickHandler() { /* You code here */ } </script> 
0
source share

All Articles