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 edited

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

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence whiteboards, whiteboard templates, template contest, visual collaboration, atlassian learning, confluence community, brainstorming tools, agile planning, team productivity, confluence templates, share your template

Share Your Confluence Whiteboard Template for a Chance to Be Featured in the Product! 🏆

Want to leave your mark on Confluence? One winner will have their whiteboard design added into Confluence for all users to access! This is your chance to showcase your creativity, help others, and gain recognition in the Confluence community.

Share your template today!
AUG Leaders

Atlassian Community Events