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 8715251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:48:07+00:00 2026-06-13T05:48:07+00:00

Hi I have a menu like this into my website: <div class=menu> <p align=left

  • 0

Hi I have a menu like this into my website:

<div class="menu">
    <p align="left" id="home" class="titolo_menu">home</p>
    <p align="left" id="azienda" class="titolo_menu azienda"><br>azienda</p>
    <p align="left" id="staff" class="titolo_sotto_menu azienda">staff</p>
    <p align="left" id="risorseumane" class="titolo_sotto_menu azienda">risorse umane</p>
    <p align="left" id="servizi" class="titolo_menu servizi"><br>servizi</p>
    <p align="left" id="servizioclienti" class="titolo_sotto_menu servizi">servizio clienti</p>
    <p align="left" id="prodotti" class="titolo_menu prodotti"><br>prodotti</p>
    <p align="left" id="web" class="titolo_sotto_menu prodotti">web</p>
</div>

I want to check when I click an element if has a class of the old page.
I store the id of old page in my php session and retrieve after in javascript.
Example my old page id is: “azienda” (is the of the p of my menu).
I search into my menu the element that have the id “azienda” and I want to compair with the element that I have click now for example staff.
I want to compaire if my p with id”staff” contain a part of class, in this case “azienda”, with old p clicked. In this case match.
The problem is that I have two classes into my p, if there was only one isn’t a problem but with two I want to compair only the second class.

 $('.titolo_sotto_menu').click(function(){
        var id=$(this).attr('id');//staff
        var class=$(this).attr('class');
        var page=id;

        old_page=actual_page;//azienda
        actual_page=page;

        var class_old = $('#'+old_page).attr('class');

        if (class == class_old){
            //do something
        }   
});
  • 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-13T05:48:09+00:00Added an answer on June 13, 2026 at 5:48 am

    You can use the function element.hasClass(‘classname’) of jQuery.

    var classes[] = class.split(' ');
    for(var i=0; i<classes.length; i++){
    if ($('#'+old_page).hasClass(classes[i])){
                //do something
            }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nested menu like this: <ul id=menu> <li>Home <ul> <li>New</li> <li class=selected>Open</li>
I have a menu list something like this: <ul class=submenuList> <li><a onclick=loadItem('Blue%20Orchid%20Press') id=Blue%20Orchid%20Press>class=on>Blue Orchid
I have a menu which looks like this: When the user clicks on Recruitment,
I have a menu click event that looks something like this.... Public Sub ToolbarManager_ToolClick(sender
I have an options_menu.xml file like this: <?xml version=1.0 encoding=utf-8?> <menu xmlns:android=http://schemas.android.com/apk/res/android> <item android:id=@+id/search
I have a menu that looks something like this: <MenuItem x:Name=menu ItemsSource={Binding Items} Style={StaticResource
I have a horizontal menu on a page like this <link rel=stylesheet type=text/css href=/classified/siteassets/css/mymenu.css
I have a jQuery menu which is build up by like this: <h3 id='300'
I have a selectmenu like this: $(#Menu).empty(); for (i = 0; i < data.length;
I have a simple dropdown menu and I'd like to have this menu close/hide

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.