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
Post a Comment