Altough I'm using jQuery for some time, this is my first post here about an issue that I really got stuck with. Otherwise jQuery is really nice and simple to use.
Right now I'm having code like this
$params = getQsParam(document.location.search);
if ($params.br != undefined) $(">li>a[href*='&br="+$params.br+"']", panel.series).each(function(){
if (getQsParam(this.href).br == $params.br) {
$(this).parent().addClass('active');
}
});
I'd like to simplify this to
$params = getQsParam(document.location.search);
if ($params.br != undefined) $(">li>a[href*='&br="+$params.br+"']", panel.series).parent().addClass('active');
getQSParam is a function that breaks up everything after the ? in an URL into an object
The second approach is unfortunately so far not good enough, When there are links with &br=100 and &br=1000 on a page and the document.location contains &br=100 . Both links will be selected. Also that &br search part can be anywhere mixed up with other search parts, but it's never is the first search element.
Is it possible to use regular expression in the jQuery selector to achieve my desired goal of a one line code and/or add a word, EOL boundary condition like those found in PCRE.
You might notice that in the example that works fine I have to make an extra call for each link, which slows down things more than I prefer, especially since the selector for jquery already does almost the same.
If jQuery can't do this yet with a one liner, I want to ask is there any merit for future releases to expand functionality to use PCRE like selector search.