Thursday 4 July 2019

checkbox - Jquery, Show/hide div, label for issue

I'm wondering if anyone can help.


I'm having a little difficulty with showing/hiding a div based on a click on a checkbox and its label.


If I have label for along with the id of the checkbox, it calls the jquery twice, which shows and then hides the div I wish to either be shown or hidden (depending on what the current state is)


The JS/Jquery is here:


 

Option 1:


  



The problem with the above is that it shows and then hides the div in question. Or hides and then shows. Depending on which is currently available.


Option 2:


  
Unknown Issues



The problem with the above is that although the text is clickable and works with the jquery function. I cannot get the checkbox to be checked or unchecked if you click the text.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...