I am using CB conditional to create a multi step form, and am trying to add some Javascript code to show/hide a map on the registration form depending on which tab is selected.
I am using the CB Auto Action plugin to inject javascript using the onBeforeRegisterFormDisplay trigger. However, the DOM for the tabs is generated dynamically by Javascript which is called
after my Javascript. This means that I cannot add a listener to the tabs, because they do not exist when my Javascript is called.
You can see what I am talking about here:
www.dasa.org.uk.gridhosted.co.uk/registration
Can anyone suggest a way around this problem - maybe a different Auto Action trigger?
The code I am injecting using CB Auto action is as follows:
var tabCheck = {
ready : function() {
alert('tabcheck.ready() called - the tab DOM does not exist at this stage.');
jQuery('#stepbystep ul li a').click(
function(e) {
alert('Tab has been clicked');
}
);
}
};
$(document).ready(tabCheck.ready);