Forums

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

Announcement Banner Javascript

.Rok Kompan June 12, 2019

Hi.

 

When I put this code in the announcment banner it works (alert happens - Object).

<script type='text/javascript'>

jQuery().ready(function() {
alert($( "#ghx-column-header-group" );
});

</script>

When I put this code in the announcment banner it does not (alert does not happen)

 

<script type='text/javascript'>

jQuery().ready(function() {
$( "#ghx-column-header-group" ).each(function() {
alert(1);
});
});

</script>

What are the limits of putting javascript or jquery in the announcment banner.

 

I use jira server v8.1.0

2 answers

0 votes
.Rok Kompan June 13, 2019

If I put this style in the announcement banner, the colors are applied:

<style>
#ghx-column-header-group
{
background-color: red;
}
</style>

 When I put this js (which should have the same result) it doesnt:

<script type='text/javascript'>
AJS.$(document).ready(function() {
AJS.$('#ghx-column-header-group').css("background-color","red");
});
</script>
0 votes
.Rok Kompan June 12, 2019

I have tried more, it seems like some objects are not visible to jquery.

If I run this code:

<script type='text/javascript'>
AJS.$(document).ready(function() {
alert(0);
AJS.$('#page').each(function(){
alert(1);
});
alert(2);
});
</script>

All 3 alerts will work (#page is a top level div)

But if I do the same of some deeper element like this:

<script type='text/javascript'>
AJS.$(document).ready(function() {
alert(0);
AJS.$('#ghx-pool-column').each(function(){
alert(1);
});
alert(2);
});
</script>

I only get alert 0 and 2

Suggest an answer

Log in or Sign up to answer