Can we validate a html page fields which does not contain form tag using jquery?
This is code snippet of my html page can i validate the two text feilds specified using jquery ,i am not using any form tag in my html page
<div id="panel1">
<fieldset id="fieldset1"> <legend>Registration Details:</legend>
Name of business:<br/>
<input size="30" type="text" id="businessname"/><br/>
Keywords :<br>
<input size="30" type="text" id="keyword"/><br/>
</feildset>开发者_如何学JAVA
</div>
You can always pick up the fields by their ID, the fact that they are not wrapped in a form makes no difference:
$('#businessname')
It is not valid HTML, however, and you really should use a <form>
around form elements.
Why are you not using one?
For semantic and valid markup, you do need a <form>
tag. No question of its not being there.
精彩评论