html - Click on an LI and send that value to an input as the value with Jquery -
i trying click on li, , have value of li sent search box input value search for.
i can strip class li not know how strip out li itself. going @ wrong.
$(function(){ //var art = $('li.inliner').val(); $('li.inliner').on('click',function(){// select artist ul $( ).clone() //copy .removeclass("inliner") //remove inliner class //remove li clone?? .appendto( "input(value)?? ); //this needs inserted search input value }); })
currently can send clicked li div class removed, still li. dont know how make input value. appreciated.
if right way try like
$(function(){ //when click element.. $('li.inliner').on('click',function(){ //get text inside specific li var content= $(this).text(); //place text inside input field, can change selector target right input $('input[name='mysearchbox']').val(content); //here can else sibmiting form, or click button.. or else }); });
i hope need. made little example using different selector input. hope works you.
Comments
Post a Comment