Opening lightbox jotform when clicking on a different element

  • Profile Image
    shanlee
    Asked on February 10, 2015 at 02:08 PM

    I was wondering how I can make the form (in a lightbox) open when clicking an html element/link on my page.

    Right now the code I pasted in includes its own link that becomes added to my page, but I want to link the form to my own element.

    Thanks in advance



    This is a re-post of a comment on How to Create Your First Web Form

  • Profile Image
    bkljaic
    Answered on February 10, 2015 at 03:08 PM

    Hi,

    To do that you need to:

    1.Go to your Jotform Builder

    2.Select Embed Form

    3.Select LightBox 

    4.Copy the code 

    <script src="//d2g9qbzl5h49rh.cloudfront.net/static/feedback2.js?3.2.5339" type="text/javascript">

    var JFL_50294749479370 = new JotformFeedback({

    formId:'50294749479370',

    base:'http://jotformeu.com/',

    windowTitle:'CHALLENGE ON CUSTOM CSS CODE FOR NEW HIRES',

    background:'#FFA500',

    fontColor:'#FFFFFF',

    type:false,

    height:500,

    width:700,

    openOnLoad:false

    });

    </script>

    "<a class="lightbox-50294749479370" style="cursor:pointer;color:blue;text-decoration:underline;">TEST</a>"

    5.Paste it inside your HTML webpage

    6. a href is representing link of element which will open your form, just add a href tag inside your HTML to the place you want your link to be.

    Hope that this will help.

  • Profile Image
    Ben
    Answered on February 10, 2015 at 04:29 PM

    As mentioned by bkljaic, that is all that you should do Shanlee to have the lightbox form show up by clicking on some other element.

    <a class="lightbox-50395077146256" style="cursor:pointer;color:blue;text-decoration:underline;">TEST</a>

    If you want it to be some element like an image, you could do this:

    <a class="lightbox-50395077146256"><img src="/some image on our sever.png"/></a>

    What this would do is make that image run your lightbox form.

    You could even take it further - if needed - and add some style to the a (link) element as it was in the first blue code above.

    * One thing to note is that you should always have the class ("lightbox-50395077146256") as it is given to you by the Form Builder. I took the liberty to add the code of your jotform in the class, so it should be the same as the one you get.

    Many possibilities to make it look and behave as you want and if you have any issues with it, just let us know and we will be happy to assist with it :)

  • Profile Image
    shanlee
    Answered on February 10, 2015 at 04:55 PM

    Thank you, thank you, thank you!!

    I was unnecessarily adding in an href attribute to the link as well – my day has truely been made :)

  • Profile Image
    Ben
    Answered on February 10, 2015 at 06:06 PM

    You are welcome.

    I am glad to hear that it is working for you now as you have wanted and please do let us know if you have any further questions and we would be happy to assist :)