Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add on click event? (js)

Влад Демидик July 20, 2018

Hello!

I'm trying to send async request to route but faced one problem. On click event does not worked:

image.png

 

I see the first alert. But don't see alert after pressing the button.

Button:

image.png

Thanks :)

1 answer

1 vote
tomd
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 23, 2018

Hello,

Please make sure your object already exists, try to add right after your alert():

console.log("button exists: ", AJS.$("#test").length);

0 means that the object is not present in DOM yet...

 

Tom

Влад Демидик July 24, 2018

Error on the first line, need to use AJS.$ instead $ :)

Thanks

tomd
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 24, 2018

Good catch, thanks for the update!

Tom

Suggest an answer

Log in or Sign up to answer
TAGS
Atlassian, Team '25 Europe, Atlassian conference, AI-powered teamwork, Atlassian events, keynote speakers, Barcelona tech conference, Atlassian Williams Racing, Carlos Sainz, Jenson Button, Mike Cannon-Brookes, Anu Bharadwaj, Atlassian Rovo

Atlassian Williams Racing is coming to Team '25 Europe 🏎️

Discover the teamwork and precision behind success on and off the track. See how this high-performing team makes the impossible possible. Be one of the first 100 customers to register for a chance to win 2 tickets to an Atlassian Williams 2026 race.

Register now
AUG Leaders

Atlassian Community Events