Hello,
in my apps folder I have a project "myproject" and in this folder there is a folderstructure "components/clientlibs"
./components/clientlibs/js.txt looks like this:
#base=js
mqbehaviour.js
jquery-2.1.1.js
and mqbehaviour.js contains the following code:
function testFunction() { alert('Hello from testFunction'); }
In my page I have the following button:
<form action="button.htm"> <div> <button name="Click me" type="button" value="Supprise" onclick="testFunction();"> <p> <b>What will happen?</b> </p> </button> </div> </form>
If I press the button, nothing happens - and in Firebug I get the exception: testFunction does not exist
Has anyone any idea what I am doing wrong. I thought if I add the file in js.txt than it is alos loaded and therefore the function "testFunction" should be available.
Thanks for any hint in this direction.
Max
Solved! Go to Solution.
Views
Replies
Total Likes
maximilian.quehenberger wrote...
Hello,
in my apps folder I have a project "myproject" and in this folder there is a folderstructure "components/clientlibs"
./components/clientlibs/js.txt looks like this:
#base=js
mqbehaviour.js
jquery-2.1.1.js
and mqbehaviour.js contains the following code:
function testFunction() {
alert('Hello from testFunction');
}
In my page I have the following button:
<form action="button.htm">
<div>
<button name="Click me" type="button"
value="Supprise" onclick="testFunction();">
<p>
<b>What will happen?</b>
</p>
</button>
</div>
</form>
If I press the button, nothing happens - and in Firebug I get the exception: testFunction does not exist
Has anyone any idea what I am doing wrong. I thought if I add the file in js.txt than it is alos loaded and therefore the function "testFunction" should be available.
Thanks for any hint in this direction.
Max
Do you have you js files inside js folder under clientlibs. As #base js will look your javascripts files under js folder inside clientlibs. clientlbs -> js -> file.js .
Views
Replies
Total Likes
maximilian.quehenberger wrote...
Hello,
in my apps folder I have a project "myproject" and in this folder there is a folderstructure "components/clientlibs"
./components/clientlibs/js.txt looks like this:
#base=js
mqbehaviour.js
jquery-2.1.1.js
and mqbehaviour.js contains the following code:
function testFunction() {
alert('Hello from testFunction');
}
In my page I have the following button:
<form action="button.htm">
<div>
<button name="Click me" type="button"
value="Supprise" onclick="testFunction();">
<p>
<b>What will happen?</b>
</p>
</button>
</div>
</form>
If I press the button, nothing happens - and in Firebug I get the exception: testFunction does not exist
Has anyone any idea what I am doing wrong. I thought if I add the file in js.txt than it is alos loaded and therefore the function "testFunction" should be available.
Thanks for any hint in this direction.
Max
Do you have you js files inside js folder under clientlibs. As #base js will look your javascripts files under js folder inside clientlibs. clientlbs -> js -> file.js .
Views
Replies
Total Likes
try putting all files in the same clientlibs folder. That is, flatten the clientlibs folder. I have never had any issues by doing so.
Views
Replies
Total Likes
In your jsp/html code add the following before calling the function. <cq:includeClientLib js="jquerysamples" />
This should fix your issue.
Views
Replies
Total Likes
Hi,
thanks for the response. The first lines of my JSP look like this:
<%@include file="/libs/foundation/global.jsp"%> <cq:includeClientLib categories="jquerysamples" />
and css and jquery is included, but my javascript file mqbehaviour.js is not included - and I don't understand why.
Maybe someone has another hint concerning this issue
Thanks a lot!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies