简体   繁体   中英

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..."); 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') . That would give you the jQuery object. If you want the underlying DOM element, do it like this: $('#conversation_sub_kind_id_208').get(0) .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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