开发者

If either *this or *this is clicked, then do *this, or *this respectively

I was wondering if it is possible to do something like this with jQuery:

 $('#embedVid' || '#upldImg').click(function() {
  slide($('.vidEmbd') || $('#image_uploader_wrapper'));
 });

ie. if '#embedVid' is clicked, then pass '$('.vidEmbed')' to the 开发者_开发百科function 'slide', OR, if '#upldImg' is clicked, then pass '$('#image_uploader_wrapper')' to 'slide'?

It'd be nice if I could put them in one click function...

Thanks


you could put the target class as the rel attribute of the object...

$('#embedVid,#upldImg').click(function() {
  slide($($(this).attr('rel')));
 });

with:

<span id='embedVid' rel='.vidEmbd'>Some Text</span>$(
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜