Hi everyone
I’m new in chronoforms, I’m working with CFV5 and Joomla 3.3. I need to add a click event to a button, I found a “how to” and I have added a load javascript action with the code below:
It works perfectly, but now, I need to save this code in external js file and load it with
My external file looks like this
Is possible to do that from js file?
If it is possible, what changes I have to make in my external file?
Thanks in advance
Hugo G
I’m new in chronoforms, I’m working with CFV5 and Joomla 3.3. I need to add a click event to a button, I found a “how to” and I have added a load javascript action with the code below:
jQuery(document).ready(function($)
{
function addCmdTestClick()
{
$(document).on('click', 'input[name="cmdTest"]', function(){
alert('click');
});
}
addCmdTestClick();
});
It works perfectly, but now, I need to save this code in external js file and load it with
<?php
JFactory::getDocument()->addScript(JURI::base().'code/MyJS.js');
?>
My external file looks like this
function cmdTest1Click()
{
alert("CLICK from file")
}
function addCmdTest1Click()
{
alert("File Loaded OK");
/* just one of these */
$(document).on('click', 'input[name="cmdTest1"]', function(){alert("click");});
$(document).on('click', 'input[name="cmdTest1"]', cmdTest1Click);
$(document).on('click', 'input[name="cmdTest1"]', cmdTest1Click());
}
addCmdTest1Click();
I have made a lot of tests but nothing works, I know that the file is loaded correctly, but the click event is not triggered.
Is possible to do that from js file?
If it is possible, what changes I have to make in my external file?
Thanks in advance
Hugo G
This topic is locked and no more replies can be posted.