txcotrader
txcotrader

Reputation: 595

calling jquery from javascript - overlay not defined

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

Answers (1)

Joseph
Joseph

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

Related Questions