簡體   English   中英

Jquery在Windows8 HTML 5 App中不起作用

[英]Jquery not working in Windows8 HTML 5 App

我創建了新的Windows 8 HTML 5應用程序。 我添加了jquery文件。 但是Hello World! 沒有在TextBox打印

MainPage.xaml.cs中

private void Browser_Loaded(object sender, RoutedEventArgs e)
    {
        // Add your URL here
        Browser.IsScriptEnabled = true;
        Browser.Navigate(new Uri(MainUri, UriKind.Relative));
    }

HTML

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" href="/html/css/phone.css" />
    <title>Windows Phone</title>
    <script type="text/javascript" src="~/Scripts/jquery-2.0.0.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function (){
            $("#test").val("Hello World!");
        });
    </script>
</head>
<body>
    <div>
        <p>Climate</p>
    </div>
    <div id="page-title">
        <p>My Climate</p>
        <input type="text" id="test" />
    </div>
</body>
</html>

我的猜測是腳本URI中的“〜/”沒有被正確解釋,或者URI不正確。 我知道jQuery在W8應用程序中運行得很好。

我只是將它移動到您的應用程序的路徑目錄,或相對引用該文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM