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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:29:58+00:00 2026-05-24T09:29:58+00:00

I have the following XML file containing letter and word definitions in this format

  • 0

I have the following XML file containing letter and word definitions in this format A – B – C – D – etc…

<container>
    <data name="apple" definition="A sweet fruit. bla bla bla"/>
    <data name="bat" definition="bla bla bla"/>
    <data name="book" definition="bla bla bla"/>
    <data name="cat" definition="bla bla bla"/>
    <data name="cup" definition="bla bla bla"/>
</container>

If I click on B it should load bat and book in a box. If I click on book it should display related definition on the right area. How can I create this functionality using jQuery?

  • 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-05-24T09:29:58+00:00Added an answer on May 24, 2026 at 9:29 am

    If your HTML is like this:

    <div class="search" data-letter="a">A</div>
    <div class="search" data-letter="b">B</div>
    <div class="search" data-letter="c">C</div>
    <div class="search" data-letter="d">D</div>
    <div id="results"></div>
    

    Then the javascript:

    $(function(){
    
        var xml_data;
    
        // Load the XML
        $.get("your_xml_file.xml", function(data){
    
            xml_data = $(data);
    
            // On click of search buttons
            $(".search").bind("click", function(){
    
                // Clear the results div
                $("#results").html("");
    
                // Get the desired letter
                var letter = $(this).data("letter");
    
                // Loop through each result which has name attribute beginning with letter
                xml_data.find("data[name^='"+letter+"']").each(function(k, v){
    
                    // Append definition to results
                    $("#results").append($(this).attr("definition") + "<br/>");
                });
    
            });
    
        });
    
    });
    

    This should do what you are asking about.

    • 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 File: <persons> <person name=shawn> <age>34</age> <hair style=spikes>red</hair> </person> <person
I have the following xml file: <xfa:data> <form1> <Page1> <Page2> <contractInfo> ... </contractInfo> <paymentInfo>
I have the following text in xml file: <Config Builder=LP Wizard> <Libraries> <Library Name=XCAMSource/>
I have a node in my XML file containing the following: <Apple>2011-12-01T16:33:33Z</Apple> I wish
I have an xml file with the following format <someXML> <a> <b></b> <b test='someValue'></b>
I Have following in my struts.xml file <action name=ProductVerification class=com.frontend.ProductVerification> <result name=success>/jsp/product_verification.jsp</result> <result name=input>/jsp/product_verification.jsp</result>
I have got an xml file containing some attributes like <string name=my/ attribute optional=true>
I have an xml file containing basic information about products, with the following structure:
I have following xml file: <os:tax> <os:cat name=abc id=1> <os:subcat name=bcd id=11> <os:t name=def
I have following XML file - with a Book Name and respective Authors. The

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.