Hey Jacques,

Here's how you make a regexp that looks for "BlogRetrieve.aspx" in a string
: /BlogRetrieve.aspx/ or new RegExp('BlogRetrieve.aspx')
Now here's how you check wether a string matches with a regexp : "blah blah
blah".match(/blah/)

Here's a good site to learn about regexp (which are very popular amongst
developers on many languages for some reason), there's a part about
JavaScript :
http://www.regular-expressions.info/

I hope it helps you to learn, I'll let you putting the pieces together
(which basically means writing an if using the regexp to condition execution
of .addClass() ).

Michel Belleville


2009/11/13 Wacko Jacko <jackson.be...@gmail.com>

> Hi Michael,
>
> Thanks so much for taking the time to reply. I have very limited
> Javascript knowledge (learning). Are you able to offer any more clues
> to get me on track?
>
> Thanks in advance for your help!.
>
> Jack
>
> On Nov 9, 4:32 pm, Michel Belleville <michel.bellevi...@gmail.com>
> wrote:
> > Straight js : window.location.url contains current url.
> > jQuery : $('#id_of_element').addClass('class') selects and element with
> the
> > id 'id_of_element' and adds the class 'class'.
> > I'll let you add the if and write the regexp (straight JS).
> >
> > Michel Belleville
> >
> > 2009/11/9 Wacko Jacko <jackson.be...@gmail.com>
> >
> > > Hi All,
> >
> > > Just wondering if there is a way with jQuery of adding css to an id
> > > based on a url wildcard? Eg, if the current url contains
> > > 'BlogRetrieve.aspx' add .class to this #id.
> >
> > > Thanks in advance for your help.
> >
> > > Jackson
>

Reply via email to