Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在jQuery noConflict()中选择元素_Jquery - Fatal编程技术网

在jQuery noConflict()中选择元素

在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

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 () {
    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运行良好,因为我测试了它。