jQuery: selecting element that has its ID starting with a given text
Given a table with the following id attribute:
id="table.form.address.48619"
... how can I select it given only the table.form.address portion of its id?
If I try the following :
var sInputs = $('table[id=^"table开发者_StackOverflow社区\\.form\\.address"]');
alert( sInputs.html() );
I get a null
Thanks
PS - I got NO CONTROL over the way the ID gets generated :-(, it's just something I have to deal with
$('table[id^="table.form.address"]');
^=
not =^
http://jsfiddle.net/atdVN/
Try the attribute contains prefix selector.
<a href="example.html" hreflang="english">will not be outlined</a>
<script>
$('a[hreflang|="en"]').css('border','3px dotted green');
</script>
精彩评论