开发者

Can we validate a html page fields which does not contain form tag using jquery?

开发者 https://www.devze.com 2023-01-19 08:33 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号