Why is my return empty from jQuery to Velocity?
up vote
0
down vote
favorite
I am working on an add-on for Confluence. I am using Apache Velocity and Js.
When I print out my template, I get no return from my JS file where I am using jQuery. How can I establish the communication between those two correctly? Thank you!
My JS
jQuery(function ($) {
var initmyConfluenceMacro = function ()
{
$(".myConfluenceMacro").each(function()
{
var html = "wadup";
var dayDates = $(this).find("input.dayDates").val();
html = html + dayDates;
$(this).html(html);
});
};
$(document).ready(function()
{
initmyConfluenceMacro();
});
});
MY Velocity Template.vm
#requireResource("confluence.web.resources:jquery")
#requireResource("com.atlassian.tutorial.myConfluenceMacro:myConfluenceMacro-resources")
My variables : $myCustomVar
My variable js:
<div class="myConfluenceMacro">
<fieldset class="parameters hidden">
<input type="hidden" class="dayDates" value="YO! Was up dude?">
</fieldset>
</div>
javascript jquery velocity confluence
|
show 6 more comments
up vote
0
down vote
favorite
I am working on an add-on for Confluence. I am using Apache Velocity and Js.
When I print out my template, I get no return from my JS file where I am using jQuery. How can I establish the communication between those two correctly? Thank you!
My JS
jQuery(function ($) {
var initmyConfluenceMacro = function ()
{
$(".myConfluenceMacro").each(function()
{
var html = "wadup";
var dayDates = $(this).find("input.dayDates").val();
html = html + dayDates;
$(this).html(html);
});
};
$(document).ready(function()
{
initmyConfluenceMacro();
});
});
MY Velocity Template.vm
#requireResource("confluence.web.resources:jquery")
#requireResource("com.atlassian.tutorial.myConfluenceMacro:myConfluenceMacro-resources")
My variables : $myCustomVar
My variable js:
<div class="myConfluenceMacro">
<fieldset class="parameters hidden">
<input type="hidden" class="dayDates" value="YO! Was up dude?">
</fieldset>
</div>
javascript jquery velocity confluence
There's no reason to nest a$(document).ready()
setup when you're already inside a "ready" handler.
– Pointy
Nov 19 at 15:24
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
3
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
1
Well one thing you can to do investigate isconsole.log($(".myConfluenceMacro").length)
before the.each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.
– Pointy
Nov 19 at 15:34
1
Are you viewing the resulting content in a browser? That's whereconsole.log()
goes.
– Pointy
Nov 19 at 15:55
|
show 6 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am working on an add-on for Confluence. I am using Apache Velocity and Js.
When I print out my template, I get no return from my JS file where I am using jQuery. How can I establish the communication between those two correctly? Thank you!
My JS
jQuery(function ($) {
var initmyConfluenceMacro = function ()
{
$(".myConfluenceMacro").each(function()
{
var html = "wadup";
var dayDates = $(this).find("input.dayDates").val();
html = html + dayDates;
$(this).html(html);
});
};
$(document).ready(function()
{
initmyConfluenceMacro();
});
});
MY Velocity Template.vm
#requireResource("confluence.web.resources:jquery")
#requireResource("com.atlassian.tutorial.myConfluenceMacro:myConfluenceMacro-resources")
My variables : $myCustomVar
My variable js:
<div class="myConfluenceMacro">
<fieldset class="parameters hidden">
<input type="hidden" class="dayDates" value="YO! Was up dude?">
</fieldset>
</div>
javascript jquery velocity confluence
I am working on an add-on for Confluence. I am using Apache Velocity and Js.
When I print out my template, I get no return from my JS file where I am using jQuery. How can I establish the communication between those two correctly? Thank you!
My JS
jQuery(function ($) {
var initmyConfluenceMacro = function ()
{
$(".myConfluenceMacro").each(function()
{
var html = "wadup";
var dayDates = $(this).find("input.dayDates").val();
html = html + dayDates;
$(this).html(html);
});
};
$(document).ready(function()
{
initmyConfluenceMacro();
});
});
MY Velocity Template.vm
#requireResource("confluence.web.resources:jquery")
#requireResource("com.atlassian.tutorial.myConfluenceMacro:myConfluenceMacro-resources")
My variables : $myCustomVar
My variable js:
<div class="myConfluenceMacro">
<fieldset class="parameters hidden">
<input type="hidden" class="dayDates" value="YO! Was up dude?">
</fieldset>
</div>
javascript jquery velocity confluence
javascript jquery velocity confluence
asked Nov 19 at 15:23
TeslaX
449
449
There's no reason to nest a$(document).ready()
setup when you're already inside a "ready" handler.
– Pointy
Nov 19 at 15:24
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
3
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
1
Well one thing you can to do investigate isconsole.log($(".myConfluenceMacro").length)
before the.each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.
– Pointy
Nov 19 at 15:34
1
Are you viewing the resulting content in a browser? That's whereconsole.log()
goes.
– Pointy
Nov 19 at 15:55
|
show 6 more comments
There's no reason to nest a$(document).ready()
setup when you're already inside a "ready" handler.
– Pointy
Nov 19 at 15:24
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
3
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
1
Well one thing you can to do investigate isconsole.log($(".myConfluenceMacro").length)
before the.each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.
– Pointy
Nov 19 at 15:34
1
Are you viewing the resulting content in a browser? That's whereconsole.log()
goes.
– Pointy
Nov 19 at 15:55
There's no reason to nest a
$(document).ready()
setup when you're already inside a "ready" handler.– Pointy
Nov 19 at 15:24
There's no reason to nest a
$(document).ready()
setup when you're already inside a "ready" handler.– Pointy
Nov 19 at 15:24
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
3
3
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
1
1
Well one thing you can to do investigate is
console.log($(".myConfluenceMacro").length)
before the .each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.– Pointy
Nov 19 at 15:34
Well one thing you can to do investigate is
console.log($(".myConfluenceMacro").length)
before the .each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.– Pointy
Nov 19 at 15:34
1
1
Are you viewing the resulting content in a browser? That's where
console.log()
goes.– Pointy
Nov 19 at 15:55
Are you viewing the resulting content in a browser? That's where
console.log()
goes.– Pointy
Nov 19 at 15:55
|
show 6 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
I managed it. Like this, it is working, and I get the HTML back!
JS
$(document).ready(function(){
$(".myConfluenceMacro").each(function(){
$(this).html("Hello <b>world!</b>");
});
});
VELOCITY
<script type="text/javascript">
#include( "templates/currencyDetail.js")
</script>
<body>
<div class="myConfluenceMacro">
</div>
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
I managed it. Like this, it is working, and I get the HTML back!
JS
$(document).ready(function(){
$(".myConfluenceMacro").each(function(){
$(this).html("Hello <b>world!</b>");
});
});
VELOCITY
<script type="text/javascript">
#include( "templates/currencyDetail.js")
</script>
<body>
<div class="myConfluenceMacro">
</div>
add a comment |
up vote
0
down vote
accepted
I managed it. Like this, it is working, and I get the HTML back!
JS
$(document).ready(function(){
$(".myConfluenceMacro").each(function(){
$(this).html("Hello <b>world!</b>");
});
});
VELOCITY
<script type="text/javascript">
#include( "templates/currencyDetail.js")
</script>
<body>
<div class="myConfluenceMacro">
</div>
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I managed it. Like this, it is working, and I get the HTML back!
JS
$(document).ready(function(){
$(".myConfluenceMacro").each(function(){
$(this).html("Hello <b>world!</b>");
});
});
VELOCITY
<script type="text/javascript">
#include( "templates/currencyDetail.js")
</script>
<body>
<div class="myConfluenceMacro">
</div>
I managed it. Like this, it is working, and I get the HTML back!
JS
$(document).ready(function(){
$(".myConfluenceMacro").each(function(){
$(this).html("Hello <b>world!</b>");
});
});
VELOCITY
<script type="text/javascript">
#include( "templates/currencyDetail.js")
</script>
<body>
<div class="myConfluenceMacro">
</div>
answered Nov 22 at 11:38
TeslaX
449
449
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377745%2fwhy-is-my-return-empty-from-jquery-to-velocity%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
There's no reason to nest a
$(document).ready()
setup when you're already inside a "ready" handler.– Pointy
Nov 19 at 15:24
@Pointy making sure it is really ready
– epascarello
Nov 19 at 15:26
3
You need to debug and find out why it is not being found. My guess is something gets loaded dynamically and you are trying to look for it before it is on the page. console.log and debugger are your friend.
– epascarello
Nov 19 at 15:27
1
Well one thing you can to do investigate is
console.log($(".myConfluenceMacro").length)
before the.each()
call. That'll tell you if the DOM contains any instances of the macro contents after expansion.– Pointy
Nov 19 at 15:34
1
Are you viewing the resulting content in a browser? That's where
console.log()
goes.– Pointy
Nov 19 at 15:55