javascript - Setting a cookie in jquery based on input box -


i ma new javascript using jquery , jquery cookie library. wondering how can put contents of input text box cookie.

this code have tried hasn't worked:

js

$.cookie("location_input", "#lat"); 

html

<input id="loc" placeholder="location" type="text"></input> 

is there else stopping working or have not done bit of code correctly?

you need like:

$.cookie("location_input", $("#lat").val()); 

at moment setting cookie string value #lat, not actual value of input.

also think example has typo, #lat instead of #loc :)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -