我有兩個不同的頁面,我正在使用。其中一個沒有這個問題,另一個沒有問題。問題是我有span標記,我有一個類用於檢測變化並執行操作。例如關於手機上發生的Jquery問題發生在一個頁面上,而不是另一個
$(document).ready(function() {
$(document).on("click",".test",function(){
$(this).html("changed");
});
});
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Invoice Management</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="http://hayageek.github.io/jQuery-Upload-File/jquery.uploadfile.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="Scripts/controlscript.js"></script>
</head>
<span class="test" style="background-color:red;">Hello</span>
因此,單擊具有測試類的跨度標記應更改要更改的文本。這在我的電腦上工作得很好,但當我在移動設備上嘗試時,它什麼也不做。陌生人的問題是,我有另一個頁面,我用鏈接相同的方法,它工作得很好。任何想法爲什麼會發生這種情況?
加上'$(文件)。就緒(函數(){'腳本在''
作爲要添加的jQuery的lib頭,但增加的頭。 –@Bhushan Kawadkar前的腳本標籤,他已經顯示出他的代碼結束。不像現在這樣,因爲他不能在沒有腳本標記的情況下執行它。 – PHJCJO
@PHJCJO,是的,可能是你的權利,但我只是想過如果是這樣的話 –