BS3 Dropdown Hide

How can i make BS3 Dropdown hidden if there is nothing in the dropdown list

I try this, but not working

if dropdown1.length<=0 then dropdown1.visible=false

Thanks
Teo

Try this:

if dropdown1.length<=0 then dropdown1.style.display="none"

To show it again:

if dropdown1.length<=0 then dropdown1.style.display="block"