Skip to main content

jMaki rocks! Changing the yahoo.button label on the fly

No replies
svixxer
Offline
Joined: 2008-03-11

I'm new to js and ajax, but I'm liking jMaki more and more!

So I thought I would share a few things.. for yahoo.button. The standard function getValue() is actually getVal(), and it returns the value of the button not the label. What I needed was to change the label, and that was as easy as adding the get/set label functions in the component.js file:

this.setVal = function(arg) {
return button.set("value",arg);
}

this.getLabel = function() {
return button.get("label");
}

this.setLabel = function(arg) {
return button.set("label", arg);
}

glue.js:
var btn = jmaki.getWidget('myBtn'); //myBtn is the id='' in the component tag
btn.setLabel("hello");

Rock on!