jQuery $("#field")为null? [英] jQuery $("#field") is null?
本文介绍了jQuery $("#field")为null?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有月份的选择框。
I have a selectbox with month periods in it.
这是我的代码:
$(function(){
$("#ppsub_ppterm_id").change(function(){
var term = this.options[this.selectedIndex].text;
if(term == "Eenmalig"){
$(".idealtd").show();
}else{
$(".idealtd").hide();
//$("#ppsub_amount option:selected").val('anders');
}
});
});
<select name="ppsub_ppterm_id" class="ppsub_ppterm_id"
id="ppsub_ppterm_id" style="width: 100px; font-size: 11px;">
<option value="M">Maand</option>
<option value="K">Kwartaal</option>
<option value="H">Halfjaar</option>
<option value="J">Jaar</option>
<option selected value="E">Eenmalig</option>
</select>
但是当我加载我的页面,我staight离得到一个错误:
But when i load my page i staight away get an error:
$(#ppsub_ppterm_id)为空
$("#ppsub_ppterm_id") is null
第17行
?
推荐答案
听起来像JQuery没有正确加载。您使用哪个源/版本?
Sounds like JQuery isn't loading properly. Which source/version are you using?
或者,它可能是命名空间冲突,因此请尝试使用 jQuery
的 $
。如果有效,您可以使用 noConflict 来确保使用<$的其他代码c $ c> $ 不会中断。
Alternatively, it could be namespace collision, so try using jQuery
explicitly instead of $
. If that works, you may like to use noConflict to ensure the other code that's using $
doesn't break.
这篇关于jQuery $("#field")为null?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文