Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] Add a Class to Nav depending on URL

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26837
    creative
    Member

    When website switches to a different language from Spanish to English for example (for example: http://mywebsite.com/es to http://mywebsite.com/en) I would like to add to the nav and to the main text area a css jquery class so that special characters and others will show up correctly in Website. i have only part of the code so far:

    Code:
    jQuery.noConflict();
    jQuery(document).ready(function(){
    jQuery(“.nav”).addClass(‘red’);});

    How do I do that? Please.

    #76121
    hardik
    Member

    http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery

    use method from above link to get url and split the url into pieces by javascript split method.

    #75303
    creative
    Member

    Genius!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.