Skip to content Skip to sidebar Skip to footer

Custom Selectbox (ul-li) With Same Functionality In Html Form

I am working on HTML form on custom requirement. This is personal project and I do not want to use ready-to-use plugin. I am placing all my code here and need your help for getting

Solution 1:

You need to change your lines

var valDefault  = $('li').eq(settings.selected - 1).val();
var textDefault = $('li').eq(settings.selected - 1).text();

to

var valDefault = $(optionTag).eq(settings.selected - 1).val();
var textDefault = $(optionTag).eq(settings.selected - 1).text();

as you were selecting the nthli element on the page every time. Have a look at my demo fiddle with your console open and you''ll see what I mean.

Demo:http://jsfiddle.net/robschmuecker/358p1816/1/

Post a Comment for "Custom Selectbox (ul-li) With Same Functionality In Html Form"