jQuery在字段集中查找ID(jQuery find ID in a fieldset)

编程入门 行业动态 更新时间:2024-10-27 20:34:05
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');

更多推荐

本文发布于:2023-08-03 01:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1382901.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   jQuery   ID   fieldset   find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!