Reputation: 595
I'm interested in using some of the jquery tools(here) with a website that is designed entirely with javascript. I'm a newb with js/jquery and I'm wondering how I can call jquery functions from js? I've included the jquery CDN in index.html. Am I missing something?
When I try doing something like:
var btn = document.createElement("button");
btn.setAttribute("rel", "#thing1");
btn.onclick = function () {
$("button[rel]").overlay({mask: '#000', effect: 'apple'});
}
var b = new YAHOO.widget.Button(btn);
b.set("label","test");
b.on("click",overlay({mask: '#000', effect: 'apple'}));
I'm getting an error saying "overlay is not defined"
Any help is appreciated.
Upvotes: 1
Views: 1060
Reputation: 119847
Because overlay
seems to me like a method attached to jQuery, which can only be operated from a jQuery object:
b.on("click",function(){
$(this).overlay({mask: '#000', effect: 'apple'});
});
Upvotes: 1