+ 1

How to.. image change when checkbox selected?

I want to make an image container that when I select a specific checkbox from my list the image changes. I'm using html. Can you help?

21st Dec 2017, 4:07 PM
Emmanuel Molina Toledo
Emmanuel Molina Toledo - avatar
6 odpowiedzi
+ 1
I couldn't get "when checked" to work but; I made a .click event which changes the image when the option is pressed. Leaving the "checked event" available for any other thing to happen. :) https://code.sololearn.com/WFDwO0Tu3Dw2/?ref=app
12th Jan 2018, 6:29 PM
Emmanuel Molina Toledo
Emmanuel Molina Toledo - avatar
+ 2
You couldn’t do this with pure html I guess you should use css and jquery also
21st Dec 2017, 4:51 PM
Iman Jamaatlou
Iman Jamaatlou - avatar
+ 1
$(".checkbox").change(function() { if(this.checked) { //Do stuff } }); This this checkbox check status in query
21st Dec 2017, 5:03 PM
Iman Jamaatlou
Iman Jamaatlou - avatar
+ 1
This would be the base of what I'm trying to do. I want that when I check Brain1 checkbox, I get an image and when I check Brain 2 the image of the brain changes to another one https://code.sololearn.com/WFaFTE301x37/?ref=app
21st Dec 2017, 5:08 PM
Emmanuel Molina Toledo
Emmanuel Molina Toledo - avatar
+ 1
https://code.sololearn.com/WVI3FaQg41n7/?ref=app
21st Dec 2017, 5:18 PM
Iman Jamaatlou
Iman Jamaatlou - avatar
0
I'm also using css. How would you achieve it with jQuery? I'm learning it now.
21st Dec 2017, 5:00 PM
Emmanuel Molina Toledo
Emmanuel Molina Toledo - avatar