views:

117

answers:

1

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?

+5  A: 

sure..

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

$('.different-div').click(function(){alert('div click fired')});
Moin Zaman
OMG. Brilliant!
John
And say that I wanted to choose a child node under... say I had a span called "Test" under the .different-div...
John
by choose do you mean click the child span 'test' ?
Moin Zaman
yep, exactly...
John
ok if the child span has a class of 'test' then you'd just do this:$('.different-div .test').click();
Moin Zaman
also John, you have to increase your accept rate. 1 out of 9 questions is going to stop a lot of folks from answering your questions. you can start by accepting this answer :)
Moin Zaman
No kidding... don;t know why it was so low. I went through my old questions and assigned answers -- but the acceptance rate has not updated...
John