I'm trying to use the plugin JQuery.print
to print a certain area of the view (as an alternative to a report) but once I include the Jquery.print.js
below the inclusion of jquery.js
in the page, I get the following error in the browser console on load the page.
SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function
jQuery.print.js on line 34 It is an error in the library file, and therefore the code to use it does not work:
$('.lnkImprimir').on('click', function(e))
{
e.preventDefault();
$('#divImprimir').print();
}
Someone who has used it, and can explain it to me.
Hi, the error you are complaining about
SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function
is because you are in strict modestrict mode
. Remove the line"use strict"
in your code and it should be fixed.With this mode the compiler doesn't let you pass depending on what things, it's very good to use it since jQuery is very "free".
jQuery