How would you change the title of a button?
How would you change the title of a button?
I have a button and on the click event want to change the title. I have tried a variety of ways and the current definition is as follows, the key line being $(this).attr("title", "Show xxxx");
{
"text":"<i class=\"fa fa-list fa-2x fa-fw\" aria-hidden=\"true\"></i>",
"titleAttr":"Show all files",
"action":function ( e, dt, node, config ) {
if (usingAltSrc) {
var uSrc = cSrc;
usingAltSrc = false;
this.text(altSrcIcon);
$("#filedesc").html("All live files or still awaiting a decision");
$(this).attr("title", "Show all files");
}
else {
var uSrc = altSrc;
usingAltSrc = true;
this.text(cSrcIcon);
$("#filedesc").html("All files");
$(this).attr("title", "Show filtered list");
};
$("#filelist").DataTable().ajax.url(uSrc).load();
}
any ideas?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This example from this thread should help - it's showing just that.
Colin
Thanks Colin, but it is the title attribute (titleAttr) that I am trying to update. Changing the text on the button works fine (this.text), but I can't get it to change the title attribute (which pops up on Mouse Over).
Ah, you can use
button().node()
for that, see here.Colin