Is there a way for the confirmation dialog to display the value entered by the user in the form text box? (For example, if the user enters 100.00, I would like the message “Confirm Amount” to appear in the dialog box. Click “OK” if $ 100 is the correct amount.)
Yes:
var amount = document.getElementById("textbox").value; confirm("Confirm Amount. Click OK if $" + amount + " is the correct amount.")
EDIT: Here is a working example: http://jsbin.com/inoru/edit
Of course, you can simply pass the string value in the dialog box:
var str = "my msg"; confirm(str);
, , . :
var amount = jQuery("#myTextBox").val(); confirm("Click OK if " + amount + " is the correct amount");
You should check the onblur event from the text field, if the text field is not empty then show the message, sth, like this:
document.getElementById('textboxid').onblur = function(){ if(this.value.length > 0 ) showApplicationMessage() }
Source: https://habr.com/ru/post/1756774/More articles:Confirm XML signature to remote certificate using PHP - phpconvert javascript code to html output? - javascriptIE 7 and 8 overflow: hidden issue - cssPaging and sorting grid in ASP.NET MVC - c #SSI-like function in ASP.NET/ASP.NET MVC - asp.netWhat is, does such a database exist? - c #Running Blackberry app using Eclipse debugger device resets device - blackberryNeed help with the exception "No constant for:" using Fluent Nhibernate Automapping - c #Resizing images inside Android buttons - androidIs WCF the right choice for me? - c #All Articles