Thanks for your valuable inputs, eventually I went for the following using the jquery enabled HTML snippet widget:
$( function() {
var tabhrefs = $("[class^=mx-name-tabPage]");
for (var i = 0; i < tabhrefs.length; i++) {
tabhrefs[i].addEventListener("click", tabClicked);
}
});
function tabClicked(event) {
var target = event.target || event.srcElement;
console.log('Click on ' + target.innerHTML);
// do something
};
A more Mendix integrated Dojo widget would indeed be nice too in case there are more users that need to act on tab changes.
Can you post the full script? The way to go is to add an eventlistener to the tabpane change event of a dojo tabcontainer, see:
Hi Alexander,
In my personal experience Mendix i.e. dojo with its AMD and jQuery don"t go together very well. That is why I would suggest to try and write any javascript code in pure i.e. vanilla javascript.
Here is how do the jQuery operations in javascript: Selecting objects
document.getElementById
registering event handler
object.addEventListener("select", myScript);
scheduling an onload "ready" event handler
window.onload = function() {
I hope this helps,
Andrej