Having a total mind blank here. Hoping you can help.
How would I alter this argument to be when the attribute 'href does not start with #overlay'...
if(this.getTrigger().attr("href")){
// stuff in here
}
Thanks you wonderful people. Kevin
You can use slice, substring or substr:
if (this.getTrigger().attr("href").slice(0, 8) != "#overlay") {
}
or indexOf:
if (this.getTrigger().attr("href").indexOf("#overlay") != 0) {
}
or the regex test method:
if (!/^#overlay/.test(this.getTrigger().attr("href"))) {
}
If you want to use jQuery selectors:
if(this.getTrigger().is('a:not([href^="#overlay]")')) {
// stuff in here
}
Edit: In your case where you already have only one item and want to check its href value, the selector solution performs worse than just comparing a slice of the attribute to '#overlay' as the other answers here have shown. I just posted my solution to show there is more than one way to do it.
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