dimanche 28 décembre 2014

Remember text in input via jQuery Cookie


I'm using jQuery Cookie plugin. And I want, when I write text a input, remember this text next sessions.



$(".webform-submit").click(function () {
$.cookie('telCookie', $telephoneCookie.val(), {
expires: 365
});
});

//set the value of the cookie to the element element_1
var $telephoneCookie = $("#edit-submitted-telefon").val($.cookie("telCookie"))


HTML:



<input type="text" id="edit-submitted-telefon" name="submitted[telefon]" step="any" class="form-text form-number required">


But value has not my text, so this input get undefined


How can I fix it? Thanks.





Aucun commentaire:

Enregistrer un commentaire