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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:35:34+00:00 2026-06-11T19:35:34+00:00

I have the following XML for example: <?xml version=1.0?> <extraslist> <extra id=0 enabled=1 quantityavailable=2

  • 0

I have the following XML for example:

<?xml version="1.0"?>
    <extraslist>
        <extra 
            id="0"
            enabled="1"
            quantityavailable="2"
            displayindex="1">
            <extraname>Example 1</extraname>
            <extradesc>Example 1 Description</extradesc>
        </extra>
        <extra 
            id="1"
            enabled="1"
            displayindex="2">
            <extraname>Example 2</extraname>
            <extradesc>Description 2</extradesc>
        </extra>
    </extraslist>

And a .find function that finds each extra and displays the result on a web page.

$(xmlExtras).find('extra').each(function(){

});

How would I go about writing a function so that if all ‘extras’ = enabled=”0″ to 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-11T19:35:35+00:00Added an answer on June 11, 2026 at 7:35 pm

    Update after reading question properly

    You can check the length of the find result using an extra selector:

    var $enabledExtras = $(xmlExtras).find('extra[enabled="1"]');
    
    if ($enabledExtras.length == 0) {
        //do something
    }
    

    Working jsFiddle

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

Sidebar

Related Questions

I have the following XML example <?xml version=1.0?> <test> <items> <item>item 1</item> <item>item 2</item>
I have the following XML example: <?xml version=1.0 encoding=UTF-8?> <OpenSearchDescription xmlns=http://a9.com/-/spec/opensearch/1.1/ xmlns:custom=http://example.com/opensearchextensions/1.0/> <ShortName>Test</ShortName> <Description>Testing....</Description>
Hi there I have the following XML code: <?xml version=1.0 encoding=UTF-8?> <connector_ret> <function name=search>
i have following xml <?xml version=1.0 encoding=UTF-8 ?> <Users> <User> <ID>SMSUser(63)</ID> <Email>a@example.com</Email> </User> <User>
So I have the following XML chain: $xml->assessment->outcomes_processing->outcomes->decvar->attributes()->cutvalue XML example In Some XML-files $xml->assessment->outcomes_processing->outcomes->...
I have the following in an XML file: <entry> ... <link href=http://www.example.com/somelink /> ...
In my Maven pom.xml I have the following dependencies: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.3.2.GA</version> </dependency>
I have the following XML example that I need some help on. The sample
I have the following xml: <?xml version=1.0 encoding=UTF-8?> <connection_state>conn_state</connection_state> Following the msdn, I must
sI have an XML file that looks like the following... <a> <b> <version>1.0</version> <c>

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.