Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
if ($.cookie("style") != null) {
  var savedStyle = $.cookie("style");
  $('#theme-style').attr("href", "assets/css/theme/" + savedStyle + ".css");
};

jQuery(document).ready(function() {
    if ($.cookie("style") != null) {
      $("#theme a").attr("class", "");

      var currentStyle = $("#theme").find("[data-style='" + savedStyle + "']");
      $(currentStyle).addClass("active");
    };
});
Posted
Comments
Member 11854679 29-Jul-15 1:20am    
Please suggest solution for this error
am using MVC5,AngularJS in SPA

1 solution

Make sure that you have added jQuery.Cookie to the script bundle.
"~/Scripts/jquery.cookie.*"


If not get it from here
NuGet | jQuery Cookie 1.4.0 [^]

Hope, it helps :)
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Jul-15 2:19am    
Sure, a 5.
—SA
Member 11854679 29-Jul-15 2:20am    
still am getting same error
Member 11854679 29-Jul-15 2:19am    
ya am already installed that package but still am getting same problem
Sergey Alexandrovich Kryukov 29-Jul-15 2:26am    
Well, please show us how you use the library.
—SA
Member 11854679 29-Jul-15 3:52am    
<script src="~/Scripts/jquery.cookie.js"></script>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900