Failed with JQuery Cookie

0

Good morning. I'm trying to install the JQuery library "JQuery Cookies". I have configured it as shown by the instructions, but when I run it I get an error with firebug:

TypeError: $.cookie is not a function.

In the index charge first the jquery, then the plugin of the cookies, and from there, the html code:

<!DOCTYPE html>
<html lang="en">

<head>

<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<script src="jquery-cookie/jquery.cookie.js"></script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>SB Admin 2 - Bootstrap Admin Theme</title>

<!-- Bootstrap Core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="dist/css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

In the body I have a small javascript function, which will store the value of the inputs in variable cookies:

 $(document).ready(function(ev){

    $('.container').on('click','#btnIniSesion', function(ev){
        ev.preventDefault();
        $.cookie('usuario', $('#Mail').val());
        $.cookie('clave', $('#Clave').val());


   });
});

I do not know what I can be failing.

    
asked by AntonioMP87 12.04.2017 в 13:28
source

1 answer

-2

I do not know if you have read the author's documentation that explains how to use it. The error may be because you did not put the <script src="/ruta/jquery.cookie.js"></script> link in the document.

    
answered by 12.04.2017 в 13:39