我有這樣的HTML代碼:提交按鈕不能在HTML代碼工作
<!DOCTYPE html>
<html>
<head>
<title>Modal</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="modalUI.css">
<script src="jquery-3.1.1.js"></script>
<script src="jquery-3.1.1.min.js"></script>
<link rel="stylesheet" href="jquery-ui-1.12.1.custom/jquery-ui.min.css">
<script src="jquery-ui-1.12.1.custom/external/jquery/jquery.js"></script>
<script src="jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#create-user').click(function(){
$('#dialog').dialog("open");
});
$('#dialog').dialog({
draggable: true,
resizable: false,
closeOnEscape: true,
modal: true,
autoOpen: false
});
});
</script>
</head>
<body>
<form id="form1">
<table class="table table-bordered">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>[email protected]</td>
</tr>
</tbody>
</table><br>
<input type="button" value="Show Dialog" id="create-user"/>
<div id="dialog" title="Create new User">
<form id="form2" action="">
<label for="name">FirstName</label><br>
<input type="text" name="fname" ><br>
<label for="lastname">LastName</label><br>
<input type="text" name="lname" ><br>
<label for="email">Email</label><br>
<input type="email" name="email" ><br><br>
<button type="submit" value="Submit" id="submitDemo">Submit</button>
<button type="reset" value="Reset">Reset</button>
</form>
</div>
</form>
</body>
</html>
我的提交按鈕不起作用時,對話框彈出。我應該在我的jQuery上寫什麼? p.s在div對話框外提交作品。但如何讓它進入對話框?
不介意這個lorem ipsum的東西。 (Lorem存有悲坐阿梅德,consectetur adipisicing ELIT,SED做eiusmod tempor incididunt UT labore等dolore麥格納aliqua。UT enim廣告微量veniam, QUIS nostrud實習ullamco laboris暫準UT aliquip前EA commodo consequat。DUIS奧特irure悲在voluptate velit埃塞reprehenderit cillum dolore歐盟fugiat法無pariatur。Excepteur燒結靶occaecat cupidatat非 proident,必須遵守的過失魁正式開通了deserunt mollit阿尼姆ID EST laborum。)
您是否關閉了$(document).ready(function(){{ – m1crdy
}的括號您爲什麼要在提交按鈕單擊時調用submit()函數?應該自動調用它 – Vaidas
它不自動工作 – Wavelet