How to hide the listbox in php code igniter?
$options = array(
'small' => 'Small Shirt',
'开发者_StackOverflow中文版med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
); echo form_dropdown('some_name', $options, ' ' ,'id='some_id');
Now i want to hide this listbox .. How do i do this??
Hide? you mean with javascript? You're not very clear in your question, so if I misunderstood just let know
$options = array(........);
echo form_dropdown('some_name',$options,'','id="some_id"');
Hiding:
Using jQuery:
$(document).ready(function(){
$('#some_id').hide('fast');
});
Or with CSS:
#some_id { display:none; } /* this will also free up the space used by the dropdown*/
#some_id { visibility:hidden; } /* this just makes it invisible, but the space it occupies its preserved*/
Note that as forth parameter to the form_dropdown() you pass a string, so you could give it an id, a class, an onlick event, whatever. So, you can give it a 'class="invisible" id="some_id" onclick="myfunction"'
and manage it's visibility with that.
精彩评论