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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:31:43+00:00 2026-06-02T05:31:43+00:00

I am changing my code from fancybox to jquery ui, but i have some

  • 0

I am changing my code from fancybox to jquery ui, but i have some errors in this code:

<a class = "perfil_1"><h3>Luciana </h3></a>
<a class = "perfil_2"><h3>John</h3></a>
<a class = "perfil_3"><h3>Pedro </h3></a>

<div id="dialog_1">
<p>Lorem ipsum dolor sit amet</p>
</div>

<div id="dialog_2">
<p>Lorem ipsum dolor sit amet</p>
</div>

<div id="dialog_3">
<p>Lorem ipsum dolor sit amet</p>
</div>


  for (i = 1; i < 4; i++) {
            $('.perfil_'+i).click(function(){
                $('#dialog_'+i).dialog('open');
                return false;
            });
         };

Any help?, thanks.

  • 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-02T05:31:47+00:00Added an answer on June 2, 2026 at 5:31 am

    EDIT NOTE you are missing the .dialog() declaration. Without it you don’t have a dialog created and so it won’t open. Call it as $("dialog_" + i).dialog().dialog("open"); See Js fiddle for an non-styled dialog example.

    Instead of looping through each why don’t you add a class to each of the anchors, give it an index attribute use that to loop through:

    <H3><a class = "perfil" index=1>Luciana </a></h3>
    <H3><a class = "perfil" index=2>John</a></h3>
    <H3><a class = "perfil" index=3>Pedro</a></h3>
    
    <div id="dialog_1">
    <p>Lorem ipsum dolor sit amet</p>
    </div>
    
    <div id="dialog_2">
    <p>Lorem ipsum dolor sit amet</p>
    </div>
    
    <div id="dialog_3">
    <p>Lorem ipsum dolor sit amet</p>
    </div>
    
    
    $('.perfil').live("click", function(){
        var i = this.getAttribute("index");
        $('#dialog_'+i).dialog().dialog('open');
        return false;
    });
    

    On a side note, if your version of the code isn’t run inside a $(document).ready(function(){}) block or isn’t at the end of your html there is a chance the click assignment is being made before the element exists and there for isn’t being bound to your current anchors. This is why I tend to go with live or delegate so you are always guaranteed binding.

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

Sidebar

Related Questions

I have taken this code from Changing the background color of a UIAlertView? UIAlertView
In the process of changing some code, I have spilt some functions into multiple
I'm changing some Haskell code from using lists to sets. I understand everything required,
I have some code that I am porting from an SGI system using the
I have this piece of code (from the Nokia PC connectivity 3.2 example code,
I've got some (badly written) legacy code that I have to modify but I'm
I've got the following code from another question on SO to track the changing
I have a WCF service and without changing any code on the client side,
I have the following code, and i have a problem regarding changing the ringtone
I am currently changing styling from code behind by doing: Div.Style[StyleAttribute] = MyValue; I

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.