在jQuery noConflict()中选择元素
jQuery中的这一行使用在jQuery noConflict()中选择元素,jquery,Jquery,jQuery中的这一行使用$ $fname=$(":file:nth-of-type(" + $i + ")").val();//this is working in jquery 但是,当我转换到noConflict模式时,以下行不起作用: $fname=jQuery(":file:nth-of-type(" + $i + ")").val();//this is not working 我的代码是: jQuery(document).ready(function () { jQ
$
$fname=$(":file:nth-of-type(" + $i + ")").val();//this is working in jquery
但是,当我转换到noConflict模式时,以下行不起作用:
$fname=jQuery(":file:nth-of-type(" + $i + ")").val();//this is not working
我的代码是:
jQuery(document).ready(function () {
jQuery(document).on("change", "#iefile456", function () {
$nod=jQuery("#item1");
$i =1;
while($nod.html() != "" ){
$nod=$nod.next();
$i=$i+1;
}
alert($i);
$fname=jQuery(":file:nth-of-type(" + $i + ")").val();
alert($fname);
});
});
alert($i)
正在工作,但是alert($fname)
没有工作。这是在另一个函数中吗?如果你能发布更多的代码(之前/之后),这将非常有帮助。“它不起作用。”真的很好地描述了这个问题。错误?$fname包含什么?听起来像是$fname
和$i
仍然可以使用$
而不是jQuery
来定义,这意味着jQuery(…)
不能正确使用它们。另外,您不需要在变量名之前使用$
。您在哪里调用.noConflict()
?我正在为joomla编写一个模块。我在php标记中调用了.noConflict,并且.noConflict运行良好,因为我测试了它。