Hello. There is some construction Html :

 <div class='class'> <input type='checkbox' id='myCheckbox' /> </div> 

I take this checkbox item

 var checkBox = document.getElementById('myCheckbox'); 

And the question is, how do I get the element of the DIV in which this checkbox is located? Under the div element, only one element is the checkbox .

PS Without the use of libraries.

  • using jQuery: $('#myCheckBox').parent(); - Specter

1 answer 1

 var div = document.getElementById('myCheckBox').parentNode; 
  • Yeah, right. Thank you - Anton Mukhin