How do you select elements based on their style?

后端 未结 3 1718
清歌不尽
清歌不尽 2020-11-30 04:19

Using jQuery, how would you find elements which have a particular style (eg: float: left), regardless of whether it\'s an inline style or one defined in a CSS f

3条回答
  •  醉话见心
    2020-11-30 04:35

    Well, I don't know if I would approach this this way. Why not just rename those elements with a consistent ID or class name, and select that?

    If that's not an option, this should work:

    this.getElementsByTagName('div').item(0).style.float = 'left';
    

    I think.

提交回复
热议问题