HTML
explicitly prohibits the insertion of form
within another form
.
see here
In this part:
Content model:
Flow content, but with no form element Scendants.
In this highlighted part of the link, is telling what types of content categories a form
may have within it. In this case it may have elements belonging to the flow content categories, except another element form
. (The exception is due to the fact that form
is an element belonging to the flow content category). See more here.
A possible alternative would be this:
$('input.limpar').on('click', function() {
$('div.campos').find('input').val('');
});
input {
display: block;
margin-top: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<input type="text" value="campo 1" />
<input type="text" value="campo 2" />
<input type="text" value="campo 3" />
<div class="campos">
<input type="text" value="campo 4" />
<input type="text" value="campo 5" />
<input type="text" value="campo 6" />
</div>
<input class="limpar" type="button" value="limpar" />
</form>
Gee, thanks for the touch there! But there would be some other way?
– Jaider Master Info
@Jaidermasterinfo, you can leave a form alone. There, you wrap the form fields that you want to clean in a div. To clean, create a button that when clicking looks for all the camos of this new div and remove the values. I’m at work now, kind of rolled up. When relieve I can create an example here.
– LLeon
All right, man, if you can give me that strength, it’s really worth it!
– Jaider Master Info
@Jaidermasterinfo, I edited my answer with an example. Take a look and see if you can adapt to your needs. Qq thing, we are there!
– LLeon
Vey too fine! That’s right! Thanks!!!!
– Jaider Master Info