CSS selector (id contains part of text)

后端 未结 3 1479
南笙
南笙 2020-11-29 00:19

I have a question. I have elements something like this:

element with id = someGenerated Some:Same:0:name

elemen

相关标签:
3条回答
  • 2020-11-29 00:59

    Try this:

    a[id*='Some:Same'][id$='name']
    

    This will get you all a elements with id containing

    Some:Same

    and have the id ending in

    name

    0 讨论(0)
  • 2020-11-29 01:00

    The only selector I see is a[id$="name"] (all links with id finishing by "name") but it's not as restrictive as it should.

    0 讨论(0)
  • 2020-11-29 01:04
    <div id='element_123_wrapper_text'>My sample DIV</div>
    

    The Operator ^ - Match elements that starts with given value

    div[id^="element_123"] {
    
    }
    

    The Operator $ - Match elements that ends with given value

    div[id$="wrapper_text"] {
    
    }
    

    The Operator * - Match elements that have an attribute containing a given value

    div[id*="wrapper_text"] {
    
    }
    
    0 讨论(0)
提交回复
热议问题