I have some labels, like:
<label>Some words</label>
<label>Some other words</label>
<label>Yet another words</label>
How can I get labels starting with "Some" (or other text?). I tried
$("label").filter('html^="Some"')
//or
$("label").filter('text^="Some"')
but it doesn't seem to work (returns empty list). It's more complicated in my real problem so maybe I made some other mistake, but maybe I'm doing it totally wrong? Is any of these a good way to do it? What's the best way?
I would do this (jsfiddle):
$('label').filter(function(index) {
return $(this).text().search('Some') == 0;
})...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With