i have field image
. want set compulsory on button
click event in javascript.
hereis html
<input type="image" name="imgattach" id="imgattach" src="../images/attachment_1.png" onclick="return imgclick();" />
and button code
<input type="submit" name="cmdsave" value="save" onclick="return funsavevalidate();" id="cmdsave" class="button" />
note want in javascript.
for more info see js fiddle
<input type="image">
used submit form (similar <input type="submit">
), not attach image files (https://www.w3.org/tr/html5/forms.html#image-button-state-(type=image))
in order attach image files , make required field, please use <input type="file" accept="image/*" required>
Comments
Post a Comment