title: how to clear an input field onclick of an image?
body: <p>I'm creating a form inside a foreach loop. What actually I want is that... how can I clear the value of a particular input field on click of an image.
  Following is the code which is inside loop. It has many more form fields. But I want to clear a particular input field, because I'm fetching the data from database, making changes and then saving it again.</p>
  
  <pre><code>&lt;a onclick="clearField("&lt;?php echo "field_id".$language["language_id"]; ?&gt;")" 
    href="javascript:noAction();"&gt;&lt;img src="view/image/delete.png"&gt;
  &lt;/a&gt;
  
  &lt;input type="text" 
    id="&lt;?php echo 'field_id'.$language['language_id']; ?&gt;" 
    name="file_name[&lt;?php echo $language['language_id']; ?&gt;]" 
    value="&lt;?php echo isset($document_description[$language['language_id']]) ? $document_description[$language['language_id']]['file'] : ''; ?&gt;" 
    readonly="readonly"/&gt;
  </code></pre>
  
  <p>Following is the javascript which is used for above function--</p>
  
  <pre><code>&lt;script&gt;
  function clearField(input,val) {
        if(input.value == val)
           input.value="";
  };
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>EDITED :-</strong> there is one more problem with the following statement --
  all quotes which are used inside this statement are not proper. i mean to say that the  code do not gets parsed due to some missing or some additional quotes. So please tell me how to correct this.</p>
  
  <pre><code>&lt;a onclick="clearField("&lt;?php echo "field_id".$language["language_id"]; ?&gt;")" 
    href="javascript:noAction();"&gt;&lt;img src="view/image/delete.png"&gt;
  &lt;/a&gt;
  </code></pre>