Create a combobox by using HTML item list

Posted by erkan_ayan on Stack Overflow See other posts from Stack Overflow or by erkan_ayan
Published on 2014-08-24T09:40:56Z Indexed on 2014/08/24 10:20 UTC
Read the original article Hit count: 170

Filed under:
|
|

How can I show only first li and hide the others?

I am trying to do a combobox via jQuery:

My jQuery script:

var drp = $('.drpdiv');

    $(drp).each(function(index,value){

            $(this).find('li:first').text()
            $(this).find('li').hide();
            alert($(this).find('li:first').text());

    });

My html code:

<div class="drpdiv">
    <ul class="drp">
        <li>select option...</li>   
        <li>one</li>
        <li>two</li>
        <li>three</li>
    </ul>
</div>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html