drayarms Posted September 2, 2011 Share Posted September 2, 2011 Hello all, I recently made the switch from JS to JQ. In JS, it was possible to use a single inline event to call several actions, by merely separating the actions with a semi colon. In JQ, this technique does not work. Here's an example of what I'm talking about. onclick = '$(this).parent().next().next().children().eq(0).show(); (this).next().hide();'> I tried using two onclicks like this: onclick = '$(this).parent().next().next().children().eq(0).show();' onclick='$(this).next().hide();'> but in this case, only the first onclick call works. The second doesn't. So my question is, how can one achieve this if at all possible? I don't want to use functions in the head section because this particular problem requires me to use inline event calls. Thanks. Link to comment https://forums.phpfreaks.com/topic/246257-how-can-one-call-two-separate-action-with-the-same-event-in-jquery/ Share on other sites More sharing options...
AyKay47 Posted September 2, 2011 Share Posted September 2, 2011 1. the first example you have should work.. you are missing the $ call in your second bit of code.. 2. why would you need to code this inline, I personally would rather use a function.. Link to comment https://forums.phpfreaks.com/topic/246257-how-can-one-call-two-separate-action-with-the-same-event-in-jquery/#findComment-1264665 Share on other sites More sharing options...
drayarms Posted September 2, 2011 Author Share Posted September 2, 2011 @aykay47, i have a very compelling reason why i'm using inline calls in this particular example, don't think you wanna be bothered with the details. but ok i see where the error is, i just fixed it and everything works fine. thanks kalashnikov. Link to comment https://forums.phpfreaks.com/topic/246257-how-can-one-call-two-separate-action-with-the-same-event-in-jquery/#findComment-1264816 Share on other sites More sharing options...
AyKay47 Posted September 2, 2011 Share Posted September 2, 2011 MHMM Link to comment https://forums.phpfreaks.com/topic/246257-how-can-one-call-two-separate-action-with-the-same-event-in-jquery/#findComment-1264831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.