// 这行有效:
var remove = jQuery(this).closest('.item').hide();
// 为什么这行代码不能在同一个脚本中运行几行?
var discount_amount = jQuery(this).closest('.discount_amount').text();
我只是想用 .discount_amount 类获取最接近的 div 的值并将其分配给变量:-/我在这里遗漏了什么吗?
文件在这里: http ://www.extremecouponnetwork.com/templates/ja_wall/js/clip.js
此处的 HTML:
<a class="clip_it" href="javascript:void(0)" onclick="jfbc.opengraph.triggerAction('1','http://www.extremecouponnetwork.com<?php echo $this->item->link; ?>') "><img src="/templates/ja_wall/images/scissors_add.png" /><span>Clip It</span></a>
<img src="/templates/ja_wall/images/animated_scissors.gif" class="ToBeAnimated">
<br />
<div class="discount_amount" style="display: !important;"><?php echo $this->item->extraFields->DiscountAmount->value; ?></div>
<div class="percent_off" style="display: !important;"><?php echo $this->item->extraFields->PercentOff->value; ?></div>
<div class="brand_avg_sale" style="display: !important;"><?php echo $this->item->extraFields->BrandAvgSale->value; ?></div>