javascript - jQuery bind/change to Drop Down Form -
i had longer post describing trying do, don't think necessary i'm making simple. i'm working on getting zurb foundation work datatables. it's been pretty easy except drop down menu. i've had bit of tough time getting working js novice. here general syntax of foundation drop down.
<label for="customdropdown">dropdown label</label> <select style="display:none;" id="customdropdown"> <option select="selected">this dropdown</option> <option>this option</option> <option>look, third option</option> </select> <div class="custom dropdown"> <a href="#" class="current">this dropdown</a> <a href="#" class="selector"></a> <ul> <li class="selected">this dropdown</li> <li>this option</li> <li>look, third option</li> </ul> </div> where i've run problems event listener update table length fires on click on ul, table length updated selected length. because foundation js 1 updating ul li, every attempt detect change doesn't work because code firing before foundation applies class li.
so update table seems clear have detect change of either option value
$('div#example_length form select').val() or in li
$('div.custom ul li.selected').text() i tried chaining .change() function onto above detect change in value it's giving me error. i'm pretty lost here. i've spent quite bit of time trying work out.
edit: clear, i'm trying correct value drop down when it's selected. value it's 1 selected not 1 selected. because of way foundation works i'm having hard time doing green belt jquery skills.
thanks.
i feel bit stupid not figuring out quicker; such learning process.
$('div.custom ul', nlength).on('click', 'li', function(event) { foo = $(this).text(); console.log(foo); }); what discovered in 'bind' reason detecting first event, whereas 'on' detected every event action.
Comments
Post a Comment