I am using Jquery Cluetip for my tool-tips. The tool-tip content is loaded with the AJAX function in Cluetip. In the loaded content I want to use Javascript to increase usability.
index.html:
<img src="edit.png" title="Test" class="popup" rel="ajax-content.html">
onLoad.js:
$('.popup').cluetip({activation: 'click'});
ajax-content.html:
<script language="javascript" type="text/javascript">
alert('Hello world!');
</script>
Test content.
The result is a tool-tip appearing on click with the title:'Test', content:'Test content' and no alert saying 'Hello world!'. FireBug doesn't show the script nor console errors.
Any help on this?
Edit:
I figured it out.
Cluetip has a default action on processing ajax:
ajaxProcess: function(data) {
data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,'');
return data;
}
So the fix is:
$('.popup').cluetip({
activation: 'click'.
ajaxProcess: function(data) {
return data;
}
});
I'm not sure why Cluetip removes all script/style/title, probably to prevent bugs.