我尝试编写一些代码来隐藏<option>
,如果它的值等于第一个的值(动态并用php检索)
这是代码:
<select onChange="this.form.submit()" name="cart[<?php echo $_item->getId() ?>][qty]" class="input-text qty qtySelect" >
<option value="<?php echo $this->getQty() ?>" name="cart[<?php echo $_item->getId() ?>][qty]" class="input-text qty qtySelected" ><?php echo $this->getQty() ?></option>
<option value="1" name="cart[<?php echo $_item->getId() ?>][qty]" data-qty="1" class="input-text qty notSelected" label="1" ><span>1</span></option>
<option value="2" name="cart[<?php echo $_item->getId() ?>][qty]" data-qty="2" class="input-text qty notSelected" label="2" >2</option>
<option value="3" name="cart[<?php echo $_item->getId() ?>][qty]" data-qty="3" class="input-text qty notSelected" label="3">3</option>
</select>
我试图这样做:
$j('.qtySelect').change(function(){
if(('.qtySelected').val() == ('.notSelected').val())
{
$j('.notSelected').hide();
}
});
但这并没有奏效。任何想法如何实现这一目标?
答案 0 :(得分:0)
它将隐藏所有重复的选项,尝试:
library(plyr)
match_df(abc,cde,on = c("V12","V13"))
$(".qtySelect option").each(function(){
$(this).siblings("[value='"+ this.value+"']").hide();
});