jQuery在字段集中查找ID(jQuery find ID in a fieldset)
我试图找到一个select fieldset的select元素的ID,我试过了
$('#fieldsetID select #idOfSelect');和
$('#fieldsetID).find('select #idOfSelect');两者在JS控制台中显示为未定义。
我究竟做错了什么?
干杯
I am trying to find a an ID of a select element inside a fieldset, I have tried
$('#fieldsetID select #idOfSelect');And
$('#fieldsetID).find('select #idOfSelect');Both appear as undefined in the JS console.
What am I doing wrong?
Cheers
最满意答案
不要在select和id之间放置空格,因为它是select的id而不是select的子id:
$('#fieldsetID select#idOfSelect');要么,
$('#fieldsetID').find('select#idOfSelect');Don't put space between select and it's id as it is the id of select not the children id of the select:
$('#fieldsetID select#idOfSelect');Or,
$('#fieldsetID').find('select#idOfSelect');更多推荐
发布评论