How can I select the "container" div if the input checkbox inside "myCheck" is checked?
I am using the jquery print area plugin, so basically if checkbox is checked, I need to select the container div so the code should look something like $(".myCheck input:checked > div").printArea();
Here is my HTML:
<div class="content">
<div class = "myCheck"><input type="checkbox" />
<div class = "container">
<img src="https://www.kent.ac.uk/graduateschool/images/email-thumbnail.jpg" alt="My new Image">
</div>
</div>
</div>
I have tried using the > selector but it does not seem to work:
alert( $(".myCheck input:checked > div").printArea()
Also tried this:
alert( $(".myCheck input:checked").children()).printArea()
inputelement does not have children, soinput > divis incorrect as a selector.parent()or any other structure relation function