Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>use the following jQuery to set specified field to blank:</p> <pre><code>$("#btn_reset").click(function(){ $("input:text[id=xxx]").val(""); }); </code></pre> <p>Use the following jQuery to set all fields values to blank:</p> <pre><code>$("#btn_reset").click(function(){ $(":input").val(""); }); </code></pre> <p>In the above examples, #btn_reset is the ID of the Reset button. You will also need to place the above script inside your script tag inside the normal $(document).ready() function's handler of your page. of course, the above will require you to include the jQuery library first in the top of the page. If you have any questions please let me know.</p> <p>Here is the complete HTML file that works:</p> <pre><code>&lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt;&lt;/TITLE&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { $("#btn_reset").click(function() { $("input:text[id=xxx]").val(""); }); }); &lt;/script&gt; &lt;/HEAD&gt; &lt;BODY&gt; &lt;form&gt; &lt;input type="text" name="xxx" id="xxx" value="default" /&gt; &lt;input type="button" value="Reset" id="btn_reset" /&gt; &lt;/form&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre> <p>Please note you need change the button type from reset to button as otherwise after jQuery sets the value then the reset button behavior will again set the value to the default value which we dont want.</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.
    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