【发布时间】:2018-10-22 07:06:46
【问题描述】:
假设我有这个div 块:
<div id="some_id" style="display: none;">
<form action="someAction" method="post">
<input type="hidden" name="some-name" value="some-value">
</form>
</div>
我需要在这个div 中选择form。我可以通过$('#some_id') 选择div,但是当我尝试通过$('#some_id').find('form')(或get 或$('#some_id:form'))选择form 时,我收到此错误:
Uncaught TypeError: $(...).find is not a function
任何可能的解决方案?
【问题讨论】:
-
$可能不是 jQuery?console.log($.fn.jquery)看看有没有版本号。 -
我得到了
Cannot read property 'jquery' of undefined,但$('#some_id')怎么工作? -
评论是“可能重复”而不是问题本身。
-
副本可以解释为什么
$在您的用例中不是 jQuery。$('#some_id').find('form')是一个有效的操作。如果 '$' 不是 jQuery,那么这个问题的答案就像“在你的页面中包含 jQuery”一样简单
标签: javascript jquery html dom jquery-selectors