Note that there are some explanatory texts on larger screens.

plurals
  1. POUnexpected page refresh after callback function
    text
    copied!<p>Does anyone have any idea why the following callback doesn't execute the code within? I have a <code>window.onload</code> script (the only one) in my main <code>.html</code> page which is called, for some reason, immediately after the <code>fadeTo</code>. </p> <pre><code>$("#newentryform").fadeTo("fast", .25, function () { var newentry = prompt("Please enter a new item:", ""); if ((newentry != null) &amp;&amp; (newentry != "")) { var verify = confirm("Press 'OK' to confirm you wish to create a new entry:" + "\n" + newentry); if (verify == true) { processnewentry(newentry, dropid); } } }); </code></pre> <p>The above function is called from an <code>onclick</code> event in the main <code>.HTML</code> page.</p> <p>EDIT--code requested in comments</p> <p>This is the HTML around the button and onclick in question. The call is to the makenewitem function which is the function above.</p> <pre><code>&lt;div id="entryinput"&gt; &lt;p&gt;Item&lt;input type="text" id="createitem" readonly /&gt;&lt;button id="createitembutton"onClick="showbuttons(this.id)"&gt;Select...&lt;/button&gt;&lt;button id="createnewitembutton" onClick="makenewitem(this.id)"&gt;+ New&lt;/button&gt;&lt;button id="itemReset" onClick="resetbuttons(this.id)"&gt;Reset&lt;/button&gt; &lt;input type="text" id="createitemval" style="display:none" readonly/&gt; &lt;input type="text" id="createitemindex" style="display:none" readonly/&gt; &lt;/p&gt; &lt;/div&gt; </code></pre> <p>This is the processnewentry function:</p> <p>function processnewentry (newentryvalue, dropid) {</p> <pre><code>if (dropid=="createnewitembutton") { dropid="createitem"; } else { dropid="olditem"; } var createnewItm=document.getElementById(dropid); createnewItm.value=newitemvalue; var createnewitemval=document.getElementById(dropid+"val"); createnewitemval.value=""; var createnewitemindex=document.getElementById(dropid+"index"); createnewitemindex.value="1"; $("#newitemform").fadeTo("fast", 1); var currentPage="newitembuttonpressed"; toggleStatus(currentPage); //disable inputs and buttons in form var hidebutton=document.getElementById(dropid+"button").style.display="none"; var subdropid=dropid.substr(6); var hidenewbutton=document.getElementById("createnew"+subdropid+"button").style.display="none"; var displaycreateinput=document.getElementById(dropid).style.display="inline"; </code></pre> <p>}</p>
 

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