Reputation: 237
I am trying to play with visibility of select tag,
Here is HTML Code;
<div id="dialog">
<label id="">Hi</label><input type="text" id="input-name" />
<select id="select-asd" class="selectpicker" name="Name" style="display:none;" hidden></select>
</div>
I've already tried visibility and display properties, but I could not get any result.
Here is JavaScript Code;
var selectAsd = document.getElementById( 'select-asd' );
selectAsd.style.display = 'none';
Thanks in Advance
UPDATE** I think The problem is because of the "selectpicker"
Upvotes: 0
Views: 2973
Reputation: 237
Here is the answer;
Since the select tag's class is selectpicker, the following code should be used to hide/show elements;
$( "#select-asd" ).selectpicker( "hide" );
Upvotes: 0
Reputation: 800
Try this... If you want to make the select visible just uncomment the javascript 2nd line
var selectAsd = document.getElementById( 'select-asd' );
selectAsd.style.display = 'none';
<div id="dialog">
<label id="">Hi</label>
<input type="text" id="input-name" />
<select id="select-asd" class="selectpicker" name="Name"></select>
</div>
Upvotes: 1