The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How can I include a html select in Confluence with jquery?

Szabó Dániel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 22, 2020

I would like to include a html select into a confluence page, and I would like to have different background color for each option. I do have the background color for each option, but when I select the option it does not keep the background color. Could someone please help?

Here is the html:

<script type="text/javascript">

AJS.$("#select").change(function(){

var color = $("option:selected", this).attr("class");

$("#select").attr("class", color); });

</script>

<select id="select" class="">

<option class="yellow">Waiting for test</option>

<option class="green">Passed</option>

<option class="red">Failed</option>

</select>

Here is the css:

 

.green {  

    background-color: green;  

}  

.yellow {  

    background-color: yellow;  

}  

.red {  

    background-color: red;  

}  

 

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events