Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript error says "confirm is not a function"
    primarykey
    data
    text
    <p>I'm using jQuery with the validation plugin when I submit a form:</p> <pre><code>$('.frmProject:visible').validate( { errorContainer: ".site_details:visible .messageBox1", errorLabelContainer: ".site_details:visible .messageBox1 span.messagehere", invalidHandler: function(form, validator) { }, rules: { site_id: { required: true, } }, messages: { site_id: "Project has no assigned site information. Click the marker on the map at left to specify the site where this project took place." }, submitHandler: function(data) { SaveProject(); } }); </code></pre> <p>In the submitHandler,</p> <pre><code>function SaveProject(){ //... load variables with input contents $.ajax({ url: 'ajax/save_project.php', dataType: 'json', data: 'id='+id+'&amp;title='+title+'&amp;project='+project+'&amp;sector='+sector+'&amp;volunteer='+volunteer+'&amp;lat='+lat+'&amp;lng='+lng+'&amp;name='+name+'&amp;mun='+mun+'&amp;prov='+prov, success: function(data) { //... load 'messages' object with stuff $.each(messages, function(key, value) { if (confirm(key)){ console.log(item); } }); } }); } </code></pre> <p>When I submit the validated form and it gets to the confirm inside the each loop, I get the error message: "confirm is not a function".</p> <p>How can I present a message to the user for confirmation?</p> <p><strong>Edit:</strong></p> <p>When I type "confirm" into the console I get this:</p> <p><img src="https://i.stack.imgur.com/DjGrT.png" alt="Screen capture of console output"></p> <p>Inspecting in DOM reveals:</p> <p><em>window > confirm() There are no properties to show for this object.</em></p> <p>Inspecting in Script takes me to a place in jquery-1.6.2.min.js</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload