简体   繁体   English

JavaScript中的选择器

[英]the selector in JavaScript

I want to get the object of this code , 我想获取此代码的对象,

<input class="radio" 
       id="conversation_sub_kind_id_208"
       name="conversation[sub_kind_id]"
       onclick="set_department_name('department_name208')"
       type="radio"
       value="208" />

I want to use jQuery Framework to get the object, like the document.getElementbyTagName("conv..."); 我想使用jQuery Framework来获取对象,例如document.getElementbyTagName("conv..."); what should i do in here? 我在这里该怎么办? Thank you, and best regards! 感谢你并致以真诚的问候!

$('#conversation_sub_kind_id_208'); 

这里更多

It should be as simple as $('#conversation_sub_kind_id_208') . 它应该像$('#conversation_sub_kind_id_208')一样简单。 That would give you the jQuery object. 那会给你jQuery对象。 If you want the underlying DOM element, do it like this: $('#conversation_sub_kind_id_208').get(0) . 如果您需要基础的DOM元素,请按照以下步骤进行操作: $('#conversation_sub_kind_id_208').get(0)

否则,您将无法使用Jquery并只是这样做: document.getElementById("conversation_sub_kind_id_208");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM