我試圖讓文本框的值,彈出確認...如何讓文本框的值爲jQuery變量並進行彈出確認?
但它不工作
幫我請...
function myfunction() {
var first = $('input[name=firstname]').val();
var last = $('input[name=lastname]').val();
alert(first); // Shows alert
//But here i need to get all the text box values and display it in the popup box
// After confirmation(OK) the form will submmit to second page
// Incase of cancel it returns to the form
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<form action="second.html" method="post" onsubmit="myfunction()">
First Name: <input type="text" name="firstname">
Last name: <input type="text" name="lastname">
<input type="submit" value="submit">
</form>
你的意思是結合'first'和'last'? – 2015-03-03 13:21:41
你到底需要什麼幫助? – PeterKA 2015-03-03 13:23:29
@PeterKA閱讀代碼中的註釋 – mplungjan 2015-03-03 13:34:08