Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9138309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:14:23+00:00 2026-06-17T09:14:23+00:00

I am using wordpress and a plugin called advanced ajax page loader. http://wordpress.org/extend/plugins/advanced-ajax-page-loader/ I

  • 0

I am using wordpress and a plugin called advanced ajax page loader.
http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

I am somewhat familiar with php, javascript and jquery, but not an expert by any means. I have the following block of code that excludes certain pages from loading in ajax and it works great.

jQuery(scope + "a").click(function(event){
    //if its not an admin url, or doesnt contain #
    if (  this.href.indexOf(AAPLhome) >= 0 && this.href.indexOf('/wp-') < 0 && this.href.indexOf('#') < 0 && this.href.indexOf('/search') < 0 && this.href.indexOf('/2013') < 0 && this.href.indexOf('/2012') < 0 && this.href.indexOf('/2011') < 0 && this.href.indexOf('/feed') < 0 && this.href.indexOf('/portfolio') < 0 && this.href.indexOf('/store') < 0 ){
        // stop default behaviour
        event.preventDefault();
});

As you can see I am excluding pages with certain strings in their url.

However I need to target the homepage link and by inserting the home url this way, all pages contain the home url so they are all excluded. I want to be able to insert a hasClass statement in this block of code so I can exclude a link that has a class of ‘homelink’.

This following gave me an error of this.hasClass is not a function.

this.hasClass('homelink')

So I must be doing something wrong but I’m darned if I know what.

I have tried looking at these links but didn’t get much out of it.

Jquery hasClass + If Statement

jQuery — hasClass in if statement not playing nicely

http://api.jquery.com/hasClass/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:14:24+00:00Added an answer on June 17, 2026 at 9:14 am

    You need to wrap this in $()

    $(this).hasClass('homelink');
    

    this in that case is a DOMElement and dom elements don’t have a hasClass method. By passing this to $(), it becomes a jQuery object which does have the hasClass method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using wordpress + ajax calendar future post plugin ( http://wordpress.org/extend/plugins/wordpress-plugin-ajax-calendar-with-future-posts/ ) + tiptip
I am using this plugin http://wordpress.org/extend/plugins/simple-rss-feeds-widget/ This works fine for me. i am using
I am using following WordPress plugin to send email. http://coffee2code.com/wp-plugins/configure-smtp/ I have done configuration,
I'm using a plugin called http://www.jigoshop.com with Wordpress (both the latest versions) and I'm
I'm using a WordPress plugin called Cartpauj PM for private messages, and I want
I'm using a WordPress plugin Easy FancyBox. It uses a dynamic php file for
I am using the Advanced Custom Fields wordpress plugin and I am outputting the
I am using a wordpress plugin called GD Star Rating to allow my users
I am using require_once like this require_once('../mycode.php') I am developing a wordpress plugin. My
I am using a plugin for wordpress called CMS its a plugin that makes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.