Guest User

Untitled

a guest
Aug 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. how to intergrate my code with jquery cookie
  2. $(document).ready(function() {
  3. $('.SearchResaultBodyFullUseFulls input[type="checkbox"]').click(function() {
  4. $(this).parent().parent().parent().parent().parent().parent().toggleClass('checked');
  5. });
  6. });
  7.  
  8. $.cookie('the_cookie', 'the_value');
  9.  
  10. $(document).ready(function() {
  11. // Check for cookie on page load, and set checkbox value accordingly
  12. if ($.cookie('MyCookie')) {
  13. $('.SearchResaultBodyFullUseFulls input[type="checkbox"]').attr("checked","checked");
  14. }
  15.  
  16. // Set cookie on change of value
  17. // You may consider changing this logic to set the cookie on form submission,
  18. // however you've not given enough information about your form for me to show this.
  19. $('.SearchResaultBodyFullUseFulls input[type="checkbox"]').click(function() {
  20. $(this).parent().parent().parent().parent().parent().parent().toggleClass('checked');
  21. $.cookie('MyCookie', $(this).is(":checked"));
  22. });
  23. });
Add Comment
Please, Sign In to add comment