[jQuery] Re: Testing the first character of an H1

2009-09-03 Thread KeeganWatkins
You can always create a new selector, one that works *almost* as :contains does. The issue in your case (as I understand it) is that :contains does a global search, so text that is not at the beginning is still matched. It sounds like what you need is a :begins- with filter. Extending the filter

[jQuery] Re: Testing the first character of an H1

2009-09-03 Thread dashard
Where would I put the jQuery.expr code you created? Would love to test. And thanks in advance! On Sep 3, 10:32 am, KeeganWatkins keeganwatk...@gmail.com wrote: You can always create a new selector, one that works *almost* as :contains does. The issue in your case (as I understand it) is

[jQuery] Re: Testing the first character of an H1

2009-09-03 Thread dashard
jQuery.expr[ : ][begins-with] = function(elem, index, match) { return ( new RegExp(^ + match[3]).test( elem.textContent || elem.innerText || )); } $(p:begins-with('\“'), h1:begins-with('\“'), h2:begins-with