小编ark*_*eph的帖子

jQuery用img包装img

你好,如果类有锚,我试图用锚包装图像.

jQuery的:

if ( $(".views-row:has(a)").length) {
    var noderef = $(this).attr("anchor");
    $(".views-field-field-teaserbox-fid img").wrap("[anchor = "'+noderef+'" ]");
}
Run Code Online (Sandbox Code Playgroud)

HTML:

    <div class="view-content">
        <div class="views-row">

          <div class="views-field-field-node-ref-nid">
           <span class="field-content"><a class="active" href="/all-essentials-inspiring-events">All the essentials of inspiring events.</a></span>
         </div>

         <div class="views-field-field-teaserbox-fid">
            <span class="field-content"><img width="208" height="137" src="http://localhost:8888/sites/default/files/wedding_Giveaway_teaser.jpg?1283880578" alt="" class="imagefield imagefield-field_teaserbox"></span>
    </div>
Run Code Online (Sandbox Code Playgroud)

另外,我应该使用双引号还是单引号?

jquery

7
推荐指数
1
解决办法
5204
查看次数

jquery find .html()等于val();

我有一个ajax表单,我需要找到输入的5位数字zip. - val();

var zip = ($("#edit-field-zip-value").val());
Run Code Online (Sandbox Code Playgroud)

提交后,结果将加载到最多10个拉链的表格中.在10个拉链中,需要使用jquery来识别.

$(".zip div:html[text=zip]").addClass("equal");
Run Code Online (Sandbox Code Playgroud)

以上这条线显然是不正确的.有人可以帮忙吗?如果我的jquery行无法实现,那么我对另一个更灵活的解决方案持开放态度.

例如:

if (zip == tablezip) {
  console.log("hello"); 
}
Run Code Online (Sandbox Code Playgroud)

加价:

<td>
  <div class="zip">
   <div>90042</div>
   <div>90052</div>
   <div>90062</div>
   <div>90072</div>
   <div>90082</div>
  </div>
</td>
Run Code Online (Sandbox Code Playgroud)

variables jquery jquery-selectors

2
推荐指数
1
解决办法
8238
查看次数

标签 统计

jquery ×2

jquery-selectors ×1

variables ×1