Show and hide elements in a Velocity Template using a button

Hi everyone, i'm new on creating velocities templates, and I wonder how to hide and show a table or any html element using a button, if it's clicked the element is shown, clicked again and this should be hidden, I've seen a similar question here but it didn't involved an event trigger by an action like clicking a button, thanks!

1 answer

0 votes


If you define your own velocity template then you should use Jquery to hide an element. Something like AJS.$("element").hide(). Have a look at jquery documentation.

So I can use jquery with my template so I could use something like

<button onClick="AJS.$("element").hide()">

but my question is this, if I'm gonna use jqueryl for this, besides adding the library in the head should I need more configuration to make jquery works on my template? I ask this because I tried doing this with javascript but the templates shows only velocity sintaxis and ignores completely my js.

Where do you change your velocity file? Is it a plugin you are developing?

I'm on the server using java(theres where I change it), then I use a server method to send that template to be shown on an email.

Do you mean that you change velocity templates for email? And you want Javascrit to work in outlook or something like this?

The template is on the server with the rest of my classes, then is sent as one more parameter of the server method, I guess this compiles with the rest of the app if you mean change by compile.

If you develop a Jira plugin, then JQuery must be available there. But I really do not understand what you develop. 

Would you give me an example of a template using jquery, it'd be really helpfull, thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: More details: https://co...

75 views 1 0
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you