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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:17:34+00:00 2026-05-30T13:17:34+00:00

im having troubles displaying a fancybox window. I really don’t know anything about jquery,

  • 0

im having troubles displaying a fancybox window.
I really don’t know anything about jquery, i’m giving my first steps, so i hope you be patient.
My example:

<h:form>
        <h:outputLink id="example1" value="/Images/Flor1.jpg"  title=""  >
                <h:graphicImage alt="example1" value="/Images/TbnFlor1.jpg" />
        </h:outputLink>
</h:form>

The jquery function

$(document).ready(
    function() {
        $("a#example1").fancybox();
});

This doesn’t work, if the output link is outside the form, fancybox works. I’ve been looking an answer to solve this, but still coulnd’t find it. I hope you can help me guys, 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-05-30T13:17:36+00:00Added an answer on May 30, 2026 at 1:17 pm

    JSF generates HTML. JavaScript/jQuery works with HTML DOM tree only, not with original JSF source code. Open the page in your webbrowser, rightclick it and do a View Source. You’ll see that the generated HTML <a> element in question has its ID prefixed with the ID of the parent <form> as generated by JSF <h:form>. You need to use exactly that ID in the jQuery selector instead.

    So,

    <h:form id="form">
        <h:outputLink id="example1" value="/Images/Flor1.jpg"  title=""  >
            <h:graphicImage alt="example1" value="/Images/TbnFlor1.jpg" />
        </h:outputLink>
    </h:form>
    

    with

    $('#form\\:example1').fancybox();
    

    or

    $("[id='form:example1']").fancybox();
    

    should do. The : is an illegal character in CSS selectors, so it had to be escaped.

    Easier is however to work with style classes.

    <h:outputLink ... styleClass="fancybox" />
    

    with

    $(".fancybox").fancybox();
    

    This way you can more easily apply it on future other elements as well without the need to change the jQuery code.

    See also:

    • How to select JSF components using jQuery?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having troubles with jQuery's load function and am hoping for some help.
I am having trouble displaying the jQuery datepicker as shown here: http://jqueryui.com/demos/datepicker/ I believe
I'm having some troubles with displaying a graph. It's a very strange issue, because
I'm having troubles with displaying product information in shopping cart page. please point out
Hello I'm having trouble displaying the output of a SP in a console window
I am having trouble displaying a raw YUV file that it is in NV12
I am having trouble displaying Date s in the format I want in my
I'm having trouble with displaying image from db. I think that method for saving
I'm having troubles with HttpWebRequest/HttpWebResponse and cookies/CookieContainer/CookieCollection. The thing is, if the web server
I am having troubles migrating from OC4J 10.1.2.3 to 10.1.3.1.4. The problem is for

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.