Search code examples
javascriptjqueryfacebox

Opening a div in Facebox programmatically


Using Facebox's documentation, I'm attempting to pop up Facebox programmatically, with the Facebox content being that of a div that is in the document.

The problem is is that it is not opening with that content - it's opening blank. What am doing wrong? The full code with example is contained in this jsFiddle: http://jsfiddle.net/N4B4v/1/

<div id="#TEST10" style="display: none;">
    HEYYYY!
    <br />
    <br />
    heyyyyy!
</div>

<div style="margin-bottom: 10px;">
    <a href="#" onclick="jQuery.facebox({ div: '#TEST10' }); return false;"><input type="checkbox" name="AgreeToRequirements" /></a>Open Facebox By Checking The Box
</div>

Solution

  • The id attribute is wrong. It should be just TEST10

    Checkout this updated jsFiddle Demonstration

    <div id="TEST10" style="display: none;">
        HEYYYY!
        <br />
        <br />
        heyyyyy!
    </div>