- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
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
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.
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’);
});
Hi hotpink,
Thanks for your response, but can you be more specific please? I’m not good with Javascript…
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!
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)`
It worked CrocoDillon, thanks.