Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide all select elements within a div using jquery?

Tags:

jquery

How would I hide all of the 'select' html elements within a specific div using jquery?

Thanks

like image 922
Probocop Avatar asked Apr 24 '26 11:04

Probocop


1 Answers

If the div has class "yourClass", then you can use:

$('div.yourClass').find('select').hide();

If you identify the div by id, then it is better to use only id in the selector:

$('#divId').find('select').hide();

You can also save one function call by using "ancestor descendant" selector:

$('#divId select').hide();
like image 140
Sagi Avatar answered Apr 26 '26 02:04

Sagi