locked
Scroll Listbox selected item to be viewable? RRS feed

  • Question

  • User-609535877 posted

    I have one asp.net web page with a dropdown list control containing employees and a list box control containing job tasks employees could be assigned. Once a employee is selected from dropdown, go to database to get data and display employee's assigned tasks in the list box.

    Due to long list of tasks of list box, I want to scroll the first selected item to be viewable in the list box. How to implement jQuery function for this task? Thanks in advance!

    Thursday, August 9, 2018 6:29 PM

All replies

  • User1724605321 posted

    Hi zhao790,

    You can try with :

    $('select option:first-child').attr("selected", "selected");

    Best Regards,

    Nan Yu

    Friday, August 10, 2018 3:18 AM