jq get form stepping pit

Today I used jquery to get the form, but I couldn’t get it. Check that the id and name are spelled correctly.

<form id="a"> 
	<form id="b"></form>
	<div id="c"></div>
</form>
$('#a').get(0) //可以获取到
$('#b').get(0) //打印undefined,获取不到
$('#c').get(0) //可以获取到

Solution:
If the form is nested, the form inside the form cannot be obtained. Think of a way to change the structure

Guess you like

Origin blog.csdn.net/weixin_43939111/article/details/111277235