jQuery show()和hide()不起作用

时间:2012-02-12 10:07:32

标签: jquery toggle

在此page上,当用户在“尺寸”选择框中选择“自定义尺寸”时,预期的行为是显示自定义尺寸输入框,如胸围(英寸)和臀部(英寸)。我现在拥有的是:

<select name="options[203]" id="select_203"
 class=" required-entry product-custom-option"
 title="" onchange="opConfig.reloadPrice();if(this.options[this.selectedIndex].text=='Custom Size'){$('.custom_size').show();}else{$('.custom_size').hide();}">

基本上,我在那里使用了这个:

if(this.options[this.selectedIndex].text=='Custom Size'){$('.custom_size').show();}else{$('.custom_size').hide();}

所有可以这种方式切换的元素都有类'custom_size',样式表styles.css中的'display:none'。

但到目前为止似乎没有用。知道为什么吗?非常感谢!

2 个答案:

答案 0 :(得分:0)

刚想通了。这是noConflict()将默认$更改为$ j。现在它正在发挥作用。

答案 1 :(得分:0)

我看到你正在使用Prototype库和jQuery。您应该使用jQuery.noConflict()