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

  • SEARCH
  • Home
  • 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 9027481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:45:23+00:00 2026-06-16T06:45:23+00:00

I have this default jQuery selector (a div element) for matching a specific element:

  • 0

I have this default jQuery selector (a div element) for matching a specific element:

$('.myselectorid')

However this “myselectorid” appears in different pages of the site. I am thinking if it is possible to add a page title selector to the above original selector so that I could execute my jQuery implementation on a specific page only (specified by the page title).

Also I need all of them combined as one jQuery selector.

I also know that to retrieve the page title, it would be like this:

$('html head title').text(); 

However I am not sure how to combined the above selector to my original selector as one new selector. For example, supposing I would like it to match the selector on a page with title “This is my page title”, can I do it like this?

$('.myselectorid[html head title="This is my page title"]')

If not, how would I do it so that all of them appears as one combined selector (without using .add etc.) and it matches the page title as well?

I’m not an expert of jQuery selectors, I would appreciate if someone can share some insights on this approach. Thanks a lot!

  • 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-16T06:45:24+00:00Added an answer on June 16, 2026 at 6:45 am

    I would add a class to the body tag and then check if I should run that code based on what page I am on.

    if ($("body.className").length > 0) {
        // Place the logic pertaining to the page with the class
        //$('.myselectorid') code here
    }
    

    See this question for more ideas along this line.

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

Sidebar

Related Questions

I have this code snippet in an email layout: <div> <?php echo $this->Html->image('Layouts/default/Logo.png', array(
I have this HTML: <body> <div id=switcher class=switcher> <h3>Style Switcher</h3> <button id=switcher-default> Default </button>
I have this function function createSlidingGallery(){ gallery_position = parseInt(jQuery(.imageWrapper.default).attr(rel)); gallery_position_min = 0; gallery_position_max =
I have this code to get the default constructor: Public Function f(ByVal t As
i have this custom tab widget.. before i've customized it, by default i have
The default in Ruby on Rails is to have this set to false (in
I have a weird problem, and I don't know if this is the default
This is odd. I have a Default.png, Default-Landscape.png, Default-Portrait.png and Default@2x.png. The normal default
i have a class 'MyTextBox' that derives from the default TextBox in Silverlight. This
I have this jquery code i would like it printing on a new line

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.