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.

http://jsfiddle.net/kbfuu/1/


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -