I have this dialog function in which it asks "add(the inputted amoun)?"
In my code i used this ("Add " + amntDATA + " ?")
. but this is the outcome
Add [object HTMLInputElement] ?
html code:
Amount: <input type="text" name="contriamnt" id="contriamnt" size="15" placeholder=" Amount"></br></br>
<button id="searchbutton" type="submit" name="submit" value="Submit">ADD</button></br>
script:
function ConfirmFunction() {
var amntDATA = document.contribution.contriamnt;
if (confirm("Add " + amntDATA + " ?") == true) {
return true;
} else {
return false;
}
}
amntDATA is just an input element. You need to get the value of the amntDATA element, get it like:
function ConfirmFunction() {
var amntDATA = document.contribution.contriamnt;
if (confirm("Add " + amntDATA.value + " ?") == true) {
return true;
} else {
return false;
}
}
Just use java script property .value
eg amntDATA.value;
function ConfirmFunction() {
var amntDATA = document.contribution.contriamnt;
if (confirm("Add " + amntDATA.value + " ?") == true) {
return true;
} else {
return false;
}
}
For further reference or knowledge go through this link .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.