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

  • Home
  • SEARCH
  • 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 6121175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:45:16+00:00 2026-05-23T15:45:16+00:00

I want to make a new span class called button. When the button is

  • 0

I want to make a new span class called “button”. When the “button” is clicked, it should run jQuery and flip .front not the “button”. I tried: $('.button').bind("click",function() { but it only effects the button, not the .front.

HTML:

<span class="button">Run!</span>

jQuery:

$(document).ready(function(){

    $('.front').bind("click",function() {

        // $(this) point to the clicked .front element (caching it in elem for speed):
        var elem = $(this);

        // data('flipped') is a flag we set when we flip the element:
        if(elem.data('flipped'))
        {
            // If the element has already been flipped, use the revertFlip method
            elem.revertFlip();

            // Unsetting the flag:
            elem.data('flipped',false)
        }
        else
        {
            // Using the flip method defined by the plugin:

            elem.flip({
                direction:'tb',
                speed: 350,
                onBefore: function(){
                    // Insert the contents of the .back div (hidden from view with display:none)
                    // into the clicked .front div before the flipping animation starts:

                    elem.html(elem.siblings('.back').html());
                }
            });

            // Setting the flag:
            elem.data('flipped',true);
        }
    });

});
  • 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-23T15:45:17+00:00Added an answer on May 23, 2026 at 3:45 pm

    You need to attach the event to button, then address the element you wish to manipulate in your function, e.g.

    $(".button").click(function(){
    
      var elem = $('.front');
      …
    

    UPDATE: Example of complete page (obviously you would likely put .js and .css in external files, this is just a demo), does this do what you want? If not, why/how not :

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <title></title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript">
    </script>
        <script src="jquery.flip.min.js" type="text/javascript">
    </script>
        <script type="text/javascript">
        $(document).ready(function() {
    
            $(".button").live('click', function() {
    
                // $(this) point to the clicked .front element (caching it in elem for speed):
                var elem = $('.front');
                console.log(elem.data('flipped'));
                // data('flipped') is a flag we set when we flip the element:
                if (elem.data('flipped'))
                {
                    // If the element has already been flipped, use the revertFlip method
                    elem.revertFlip();
    
                    // Unsetting the flag:
                    elem.data('flipped', false)
                }
                else
                {
                    // Using the flip method defined by the plugin:
                    elem.flip({
                        direction: 'tb',
                        speed: 350,
                        onBefore: function() {
                            // Insert the contents of the .back div (hidden from view with display:none)
                            // into the clicked .front div before the flipping animation starts:
                            elem.html(elem.siblings('.back').html());
                        }
                    });
    
                    // Setting the flag:
                    elem.data('flipped', true);
                }
            });
    
        });
        </script>
        <style type="text/css" media="screen">
        .front
        {
        width: 400px;
        height: 300px;
        background-color: red;
        }
    
        .back
        {
        display: none;
        }
    
        .button
        {
        display: block;
        border: 1px solid black;
        width: 50px;
        }
        </style>
      </head>
      <body>
        <div class="front">
          <span class="button">Run!</span>
          <p>
            Hello World!
          </p>
        </div>
        <div class="back">
          <span class="button">Run!</span>
          <p>
            I am back
          </p>
        </div>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I on the doorstep of a new learning curve . I want to make
I want make datetimepicker in my project. Using jquery how it is possible? I
I have style sheet with a class name changebackgroundcolor i want make change in
ok not as simple as title may make it sound. I tried this in
I have the following pointer: jfloat *verticesLocal; And I want make a new copy
I am new to css, and have tried to make this work for a
Let's say I want make some of my sources publicly available via my blog
I am traversing a HTML document using javascript DOM. I want make a list
I want to make an etag that matches what Apache produces. How does apache
I want to make a table in SqlServer that will add, on insert, a

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.