Hello,
I am trying to create a button on the create issue screen using a web resource.
Can anyone help me understand what I am missing or doing wrong ?
I am trying to access the script from the web resource:
AJS.toInit(function() {
function addButton() {
const createIssueDialog = document.querySelector('#create-issue-dialog');
const descriptionField = document.querySelector('#description');
if (descriptionField && createIssueDialog) {
console.log('Description field found');
const createIssueButton = document.createElement('button');
createIssueButton.innerHTML = 'Log to console';
createIssueButton.style.display = 'block';
createIssueButton.style.marginTop = '10px';
createIssueButton.style.backgroundColor = 'red';
createIssueButton.onclick = function() {
console.log('create issue button clicked');
};
descriptionField.parentNode.insertBefore(createIssueButton, descriptionField.nextSibling);
} else {
console.log('Description field not found');
}
}
if (document.querySelector('#create-issue-dialog')) {
addButton();
}
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
if (context.closest('#create-issue-dialog').length) {
addButton();
}
});
});
Hi @Sailen Sahoo ,
This is probably not the best place to ask this question.
If you repost it here, https://community.developer.atlassian.com/, you are more likely to get an answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding the link here in case anyone wants to follow: https://community.developer.atlassian.com/t/facing-issue-with-creating-a-button-on-the-create-screen-using-atlassian-sdk/87565
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.