开发者

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

开发者 https://www.devze.com 2023-01-29 13:23 出处:网络
I was wondering if it is possible to do something like this with jQuery: $(\'#embedVid\' || \'#upldImg\').click(function() {

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

精彩评论

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