Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Checkbox with link which make appear a paragraph in a form

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #44569
    Kevin Mamaqi
    Participant

    I’m working on a form and I need to do this: [http://www.isoluxcorsan.com/es/contacto/](http://www.isoluxcorsan.com/es/contacto/http://www.isoluxcorsan.com/es/contacto/”) I refer to the checkbox with link, which when clicked open a text paragraph.

    Sorry for the name of the topic but I really don’t know how to call it better.

    Thanks in advance, Kevin.

    #134172
    hotpink
    Member

    You can use jQuery.

    Target the checkbox, and when it is clicked, toggle a css class on the paragraph you want to show/hide.

    $(‘input#valorpolitica’).click(function(){

    $(‘#LOPD’).toggleClass(‘hide-with-script’);

    });

    #134652
    Kevin Mamaqi
    Participant

    Hi hotpink,

    Thanks for your response, but can you be more specific please? I’m not good with Javascript…

    #134903
    Kevin Mamaqi
    Participant

    I think I got the important stuff working, but I need to add a page onload and I don’t know how, Can anyone tell me how to do it please?

    Check out this Pen!

    #134911
    CrocoDillon
    Participant

    Easiest way is to append this to your JS: `window.onload = ocultartexto;`

    By the way you have a parameter in that function you aren’t using, might as well remove it.

    `if(conformidad.checked==true)` => `if(conformidad.checked)`

    #141559
    Kevin Mamaqi
    Participant

    It worked CrocoDillon, thanks.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.