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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:28:33+00:00 2026-05-15T13:28:33+00:00

Since my cell phone apparently doesn’t support JQuery , but does run the simple

  • 0

Since my cell phone apparently doesn’t support JQuery, but does run the simple Javascript tests I have done, how can I convert the following JQuery code into standard Javascript?

All I need this to do is have basic click-to-hide / click-to-show functionality.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript" src="javascript/jquery-1.4.2.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $("div > div.question").mouseover(function() {
                    if($(this).next().is(':hidden')) {
                        $(this).next().show();
                    } else {
                        $(this).next().hide();
                    }
                });    
            });        
        </script>
        <style>
            div.flashcard {
                margin: 0 10px 10px 0;
            }
            div.flashcard div.question {
                background-color:#ddd;
                width: 400px;        
                padding: 5px;    
                cursor: hand;    
                cursor: pointer;
            }
            div.flashcard div.answer {
                background-color:#eee;
                width: 400px;
                padding: 5px;    
                display: none;        
            }
        </style>
    </head>
<body>
    <div id="1" class="flashcard">
    <div class="question">Who was Wagner?</div>
    <div class="answer">German composer, conductor, theatre director and essayist.</div>
    </div>

    <div id="2" class="flashcard">
    <div class="question">Who was Thalberg?</div>
    <div class="answer">a composer and one of the most distinguished virtuoso pianists of the 19th century.</div>
    </div>
</body>
</html>

Worked!

Thanks bobince!

alt text
(source: deviantsart.com)

  • 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-15T13:28:34+00:00Added an answer on May 15, 2026 at 1:28 pm

    I haven’t got a NetFront to test this on, but, trying to keep it relatively unflashy to hopefully avoid broken browser features:

    window.onload= function() {
        var divs= document.getElementsByTagName('div');
        for (var i= divs.length; i-->0;)
            if (divs[i].className==='question')
                Toggler(divs[i]);
    };
    
    function Toggler(div) {
        var state= false; // assume initially hidden
        var toggled= div.nextSibling;
        while (toggled.nodeType!==1)
            toggled= toggled.nextSibling; // find next element sibling
    
        div.onclick= function() {
            state= !state;
            toggled.style.display= state? 'block' : 'none';
        };
    };
    

    I made it use the click event rather than toggling on every mouseover, which seemed a bit strange (and unlikely to work on a mouseless phone).

    (Incidentally, avoid purely numeric id attribute values. It’s not valid and can cause odd behaviours.)

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

Sidebar

Related Questions

I'll have to get a new cell pretty soon since my current phone has
Since Intellij does not yet support the Play-Scala-Template-Engine I was thinking about using plain
I have a tableView here, and its cell is a little bit different since
I have a tableview, that contain an image for each cell. Since there will
since memcpy should be highly optimized nowadays, does it still make sense to optimize
Since regular jQuery animations are not fluent on iOS ( .hide() , slideDown() ),
Since now I have only used plugin for editing and the way I use
Since I have no errors I don't know if this is the right place
In my PyGTK application I currently use 'editable' to make cells editable. But since
I am writing a cell array of string into Excel from Matlab. I have

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.