Forums

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

Adding java script to a wen item

Pradeep A
Contributor
July 8, 2021

Hi I'm working on a web item using script fragments. I know that we need to add JavaScript code for the button to perform some functionalities. I would like to know how to add the JavaScript to the rest end point. any sample code would be helpful

 

 

Thanks

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2021

REST end points do not have any use for javascript, as they are not intended to be used as a UI in a browser.

What are you actually trying to achieve here?

Pradeep A
Contributor
July 8, 2021

Hi, I was comming through the web item examples from adaptavist docs. In the advanced dialog section they have mentioned that we need to use javascript if we need complex wiring with the buttons we create. I would like to know how

Pradeep A
Contributor
July 9, 2021

(function ($) {
$(function () {
AJS.dialog2.on("show", function (e) {
var targetId = e.target.id;
if (targetId == "my-own-dialog") {
var someDialog = AJS.dialog2(e.target);
$(e.target).find("#dialog-close-button").click(function (e) {
e.preventDefault();
someDialog.hide();
someDialog.remove();
});
// etc
}
});
});
})(AJS.$);

 

where should I add this code to?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events