我正在構建一個網頁,我嘗試使用HTML5做到這一點。不,我嘗試通過交叉瀏覽來實現日期選擇器...和耶...它的工作原理。現在的問題是,如果我將輸入標籤放在我的表單中,那麼datepicker不起作用。這裏是我的例子:jquery datepicker在表單標記
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html charset="utf-8" />
<title>My Page.</title>
<!--<link rel="stylesheet" href="blog.css" type="text/css">-->
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function(){
$("#datepicker").datepicker();
});
</script>
</head>
<body>
<form id="create_inserat" action="/inserat.php=<?php tbd ?>" method="post">
<fieldset id="inserat">
<legend>Inserat erfassen</legend>
<ol>
<li>
<label for="start">Startdatum</label>
<input type="date" name="date" id="datepicker" value="" />
</li>
</ol>
</fieldset>
</form>
....
怎麼了?爲什麼它能夠工作,如果我有form-tag的輸入標籤,但在form-tag(就像我的例子)它不起作用?
希望,有人可以幫助我。
問候,YAB
你可以爲它做小提琴嗎? – user10
在你的HTML中是否有兩個id =「datepicker」的輸入? jQuery只會選擇第一個,所以如果在表單之前有另一個,那麼它將不起作用。 http://api.jquery.com/id-selector/ –