English 中文(简体)
jquery 结合 <a> 链接 id s
原标题:jquery combining <a> links id s

This is my current code in order for each of my

 $( #fbNameS1 ).tipsy({fade: true});
 $( #fbNameS2 ).tipsy({fade: true});
 ...
 $( #fbNameS207 ).tipsy({fade: true});
 $( #fbNameS208 ).tipsy({fade: true});

我看过一些 JQuery 代码, 他们将 DIV ID 组合在一起。 在我对全部 209 提示做之前, 我想确认一下, 这样对小提示有用吗?

 $( #fbNameS1 , #fbNameS2 ,...., #fbNameS207 , #fbNameS208 ).tipsy({fade: true});
最佳回答

你可以试试这个:

$( div[id^=fbName] ).tipsy({fade: true})
问题回答

这是比用身份识别码来参照所有DIV的更干净的方法

首先,在您想要做大规模操作的每个 DIV 中添加一个类 。

<div id= fbNameS1  class= fancyboxMod doTipsyThing  />
<div id= fbNameS2  class= fancyboxMod doTipsyThing  />
<div id= fbNameS3  class= fancyboxMod doTipsyThing  />

然后,你可以用一个像这样的短选手来调整它们:

$( div.doTipsyThing ).tipsy({fade: true});

这是更可行的方法 来完成你想要做的事

UPDATE:
I updated my example to show how you would do this if you need to have another class on these elements since you said they required fancyboxMod on them.





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签