jQuery .js文件的奇怪问题(UI和普通jQuery)

时间:2012-08-08 20:30:59

标签: javascript jquery html autocomplete

  

可能重复:
  Should I include type=“text/javascript” in my SCRIPT tags?

右。花了大约4个小时用.autocomplete找出这个小虫子。

我重复了问题,因为我愚蠢而且累了,我有不同的源文件。

这有效:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"</script> <!-- -->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/jquery-ui.min.js"</script>  <!--   -->

但不是这样:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"</script> <!-- -->
<!--<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/jquery-ui.min.js"</script>  <!--   -->

也不是这样:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<!--<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"</script> <!-- -->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/jquery-ui.min.js"</script>  <!--   -->

这是文件:

    function querypage_to(element, str)
    {
        var availableTags = [
            "ActionScript",
            "Scheme"
        ];
        $("input#to").autocomplete({
            source: availableTags
        });

    }
</script>

<div>
    <form>
        <input id="to" type="text" onkeyup="querypage_to(this, this.value);" placeholder="To" autocomplete="on" ><br />
        <input type="text" onkeyup="querypage_from(this, this.value);" placeholder="From" autocomplete="on" ><br />
        <!--<input onfocus="handleFocus(this);" onblur="handleBlur(this);" value="From" type="text" onclick="querypage_from(this.value);" placeholder="From" ><br />
        <!--<input type="text" id="someInputField" value="Suggestion..." onfocus="handleFocus(this);" onblur="handleBlur(this);">-->
    </form>
</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"</script> <!-- -->
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.12/jquery-ui.min.js"</script>  <!--   -->

为什么会这样?

# 答案:我错过了“&gt;”,该死的noob错误!

0 个答案:

没有答案