$.document.getElementById
时间: 2023-10-24 07:26:17 浏览: 110
引用:$(document.getElementById("id")) 就可以由一个DOM对象变为一个Jquery 对象了。而引用:document.getElementById("id")得到的是[object HTMLDivElement]一个DOM对象。根据这两个引用内容可以得出结论,$.document.getElementById是错误的写法,因为$是Jquery的选择器,它不能直接与document.getElementById结合使用。正确的写法应该是$(document.getElementById("id"))。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [document.getElementById(id)的用法](https://blog.csdn.net/code_nutter/article/details/126048189)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [document.getElementById(“id名字”).value与$(属性名称).val()之间的区别](https://blog.csdn.net/wqr111/article/details/121980006)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文