I can’t figure out why is not working a jquery plugin (base64 encode decode) inside an event function.
This way works:
$(document).ready(function(){
data = $.base64Encode('something');
alert(data);
});
But when trying to add in an event function, I get the $.base64Encode is not a function error
$(document).ready(function(){
$('#submit').click(function(e){
data = $.base64Encode('something');
alert(data);
e.preventDefault();
});
});
The Jquery plugin is found at:
http://plugins.jquery.com/project/base64
Check that you’re not including jQuery twice in the page. What this does is the first one loads, the plugin defines itself on that
jQueryobject, and when jQuery is included a second time, thewindow.jQueryobject gets overridden…and the plugin won’t be on it 🙂You’d see this when running it later, whereas your
document.readymight be located before the 2nd jQuery inclusion.