HTML:
<script src="/javascripts/controls.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/dragdrop.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/effects.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/jquery-1.7.1.min.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/prototype.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/rails.js?1366924407" type="text/javascript"></script>
<script src="/javascripts/application.js?1366924407" type="text/javascript"></script>
<div id="new_recipe_forms">
<!--form stuff-->
</div>
<a href="#" onclick="$('#new_recipe_forms').toggle()">New recipe</a>
我有几个问题。
首先,$('#new_recipe_forms')
返回 null 而不是上面的 div。
其次,返回正确的 div,但在控制台$('new_recipe_forms')
中不响应。.css("display")
错误是TypeError: Object #<HTMLDivElement> has no method 'css'
。