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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:05:11+00:00 2026-06-10T02:05:11+00:00

Hi I have a problem… I have to show all the results generated from

  • 0

Hi I have a problem…

I have to show all the results generated from a mysql query using php, in the end I generate a “block” that shortened is like this:

<div class="resultado">

    <div class="titulo_articulo">

        <h2>Título del artículo</h2>

    </div>

    <div class="detalles_articulo">    

        <div class="datos_articulo">    

            <div class="encabezado_autores">
                <img src="images/gente.png"><span> AUTORES</span>
            </div>

            <div class="autores_instituciones">
                <li>Daniel OC - UTPL</li>
                <li>Francisco V - UTPL</li>
            </div>      

        </div>

    </div>

</div>

Sometimes searches return 5 results, so that code is inserted 5 times considering the different values (I’m not supposed to use antyhing that is not .hide() and .slide, so that’s why I get a looot of code)…

I have a line generated for each result:
Mostrar resultado n1

That line is clicked and the following event is called:

<script type="text/javascript">
    $(document).ready(function(){

        $(".resultado").hide(); 

        $('.mostrar').click(function(e){
            $(".resultado").slideToggle();          
        }); 
    });
</script>

Ok, so what do I do to use only once that event? Otherwise I have to give 5 different ids and place the script 5 times…

  • 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-10T02:05:13+00:00Added an answer on June 10, 2026 at 2:05 am

    I did this to make it work:

    Created a div called resultado with the a href inside of it, it has the class mostrar, the block that i posted has the class datos, this is the resulting script that made it:

    <script type="text/javascript">
        $(document).ready(function(){
    
            $(".datos").hide();
    
            $('.resultado').delegate('.mostrar','click',function(event){
    
              $(this).parent().find(".datos").slideToggle();
    
            }); 
        });
    </script>
    

    HTML ended up like this

    <div class="resultado">
    
        <a class="mostrar" href="#">Mostrar/Ocultar resultado 1</a>
    
        <div class="datos">
    
            <div class="titulo_articulo">
    
                <h2>Título del artículo</h2>
    
            </div>
    
            <div class="detalles_articulo">    
    
                <div class="datos_articulo">    
    
                    <div class="encabezado_autores">
    
                        <img src="images/gente.png"><span> AUTORES</span>
    
                    </div>
    
                    <div class="autores_instituciones">
    
                        <li>Daniel OC - UTPL</li>
                        <li>Francisco V - UTPL</li>
    
                    </div>      
    
                </div>
    
            </div>
    
        </div>
    
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with my query on C, I’m using the oci8 driver. This
I have problem thinking this trough with PHP & Mysql . I have read
I have problem with show or hide form in Window Form Application. I start
I have problem with UIWebView delay when the load image from url. In my
I have problem with Uploadify: I log in the project using: FormsAuthentication.SetAuthCookie(myName, false); Then,
I have problem while sending messages from android to PC. Messages are send when
Have problem while getting data from Memcached on .NET MVC solution. I have this
I have problem with php's preg_match.I want to make something like this : When
I have problem in my PHP code. I'm trying to make internet shop and
i have problem to pass data from view to controller , i have view

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.