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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:47:36+00:00 2026-06-01T06:47:36+00:00

I have the following markup – <div class=area 1 friendly> <div class=area-count> 8 </div>

  • 0

I have the following markup –

<div class="area 1 friendly">
        <div class="area-count">
            8
        </div>
    </div>
    <div class="area 2 friendly">
        <div class="area-count">
            9
        </div>
    </div>
    <div class="area 3 enemy">
        <div class="area-count">
            10
        </div>
    </div>
    <div class="area 4 friendly">
        <div class="area-count">
            11
        </div>
    </div>
    <div class="area 5 enemy">
        <div class="area-count">
            12
        </div>
    </div>

I am trying to select firstly one element that does not have a class of enemy and assigning its value to a variable, when I have that variable I then want to assign a value from a selected element that does not have a class of friendly.. I will then add these chosen values together. I have the following jQuery

$(".area").click(function(){
            $(".area").not(this,".enemy").removeClass("clicked");
            $(this).not(".enemy").toggleClass("clicked");
        });

Can anyone help me further this?

  • 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-01T06:47:37+00:00Added an answer on June 1, 2026 at 6:47 am

    From your description, I understand that you’re looking to perform this action on “friendly” divs only. Consider the following code:

    $(".area").not(".enemy").click(function() {
        var value1 = parseInt($(".area").not(this, ".enemy").first().children().html());
        var value2 = parseInt($(this).children().html());
    
        alert(value1 + value2);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following markup. <div class=area 1> <div id=area-count> 23 </div> </div> <div
I have the following markup: <div id=routes> <ul id=routesList> <li class=routes>Route 1</li> <li class=routes>Route
I have the following markup: <div id=one> <div></div> <div></div> <div></div> </div> Now, as we
I have the following markup: <!-- first marker --> <div class=marker></div> <div class=tooltip> <p>My
I have the following markup for my input fields: <div class=required> <label for=Name>Name <em>*</em></label>
I have the following markup: <div class="header">Text</div> <div class="hiddenArea">sdsada</div> <div class="header">Text2</div> <div class="hiddenArea">sdsada</div> and
I have the following markup: <div class=promo> <p class=preview><a href=#><img src=preview.png></a></p> <p class=caption><a href=/>Project
I have the following markup: <div class=user-photo> <img src= /> </div> I want to
I have the following markup <div class=content chapters current-tab> <div class=right> <div id=chapters-container-29 style=>
I have the following markup <div id=hearingSummary> <table class=minitable> ... content removed for brevity

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.