Javascript jquery显示无不工作
大师,我正在使用Jquery根据字段值选项隐藏或显示字段。以前我使用了隐藏和显示功能,它工作正常,但有空白。所以我改为使用jquerydisplaynone来隐藏字段。但是它不起作用,请帮忙,谢谢!下面是我的代码Javascript jquery显示无不工作,javascript,jquery,Javascript,Jquery,大师,我正在使用Jquery根据字段值选项隐藏或显示字段。以前我使用了隐藏和显示功能,它工作正常,但有空白。所以我改为使用jquerydisplaynone来隐藏字段。但是它不起作用,请帮忙,谢谢!下面是我的代码 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript"> jQuer
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(
function(){
hideRating('initial');
}
);
function hideRating(scope){
if(scope=='initial'){
jQuery('[id$=CallSupportBeforeOutput]').style.display = "none";
jQuery('[id$=CallSupportBeforeQuestionLabel]').style.display = "none";
}
}
jQuery(文档).ready(
函数(){
隐藏(“首字母”);
}
);
功能隐藏(范围){
如果(范围=='initial'){
jQuery('[id$=CallSupportBeforeOutput]')。style.display=“无”;
jQuery('[id$=CallSupportBeforeQuestionLabel]')。style.display=“无”;
}
}
jQuery('[id$=CallSupportBeforeOutput]')返回需要提供索引以更改元素样式的数组。请参阅下面的代码片段
jQuery(文档)。准备好了吗(
函数(){
隐藏(“首字母”);
}
);
功能隐藏(范围){
如果(范围=='initial'){
jQuery('[id$=CallSupportBeforeOutput]')[0].style.display=“无”;
jQuery(“[id$=CallSupportBeforeQuestionLabel]”)[0]。style.display=“none”;}
}
可见内容
主要内容
第二内容
jQuery(文档).ready(
函数(){
隐藏(“首字母”);
}
);
功能隐藏(范围){
如果(范围=='initial'){
jQuery('[id$=CallSupportBeforeOutput]')).css(“显示”、“无”);
jQuery('[id$=CallSupportBeforeQuestionLabel]').css(“显示”,“无”);}
}
你能试试这个吗 函数和style.display='none'是相同的功能。您必须检查CSS属性。可能会被覆盖 使用.css属性而不是.style属性,如下所示:-
jQuery('[id$=CallSupportBeforeOutput]').css("display", "none");
jQuery('[id$=CallSupportBeforeQuestionLabel]').css("display", "none");}
以下是解决方案:
jQuery('#CallSupportBeforeOutput').css("display", "none");
jQuery('#CallSupportBeforeQuestionLabel').css("display", "none");
大家好,非常感谢大家!!!您只需使用
$('#CallSupportBeforeOutput')
而不是jQuery('[id$=CallSupportBeforeOutput]')[0]
jQuery('#CallSupportBeforeOutput').css("display", "none");
jQuery('#CallSupportBeforeQuestionLabel').css("display", "none");