javascript - JQuery set cookies -


how save div title cookies? , how saved data, back?

<script type="text/javascript"> function setcookie(title, value, exp) {     var expdate = new date();     expdate.setdate(expdate.getdate() + exp);     document.cookie = title+'='+value+';expires='+expdate.togmtstring()+';path=/'; } </script>  <div title="1" onclick="setcookie();"></div> 

see this question jquery , cookies. easier use plug-in, http://plugins.jquery.com/project/cookie.

use following code title of div:

title = $("div").attr("title"); 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -