NikkiC Posted June 12, 2017 Report Share Posted June 12, 2017 Hi there, I have tabbed content on my page. One of which looks like this: <li><a data-toggle="tab" href="#menu4" style="background-color: #10368F; color: white;">5. TEST RESULT</a></li> I'd like to change the background color of this element to grey IF my dropdown (named [@Expected_Outcome]) equals Business Insight. I know I can probably figure this out, but my brain is turning to mush from looking at this and I have a deadline looming!! Can anyone help me write the correct script? Many thanks Nikki Quote Link to comment Share on other sites More sharing options...
NikkiC Posted June 13, 2017 Author Report Share Posted June 13, 2017 I'm trying this but no good: <select id="EditRecordExpected_Outcome"> <option value="1">1</option> <option value="Business Insight">Business Insight</option> <option value="3">3</option> <option value="4">4</option> </select> <script> var dropdown = document.getElementById("EditRecordExpected_Outcome"); if (dropdown.value === "Business Insight") { document.getElementById("result").style.backgroundColor = "black"; } </script> <li><a data-toggle="tab" href="#menu4" id="result" style="background-color: #10368F; color: white;">5. TEST RESULT</a></li> Quote Link to comment Share on other sites More sharing options...
NikkiC Posted June 14, 2017 Author Report Share Posted June 14, 2017 OK, now got this after a bit more research, but still not working!!! Pleeease, anyone?? <script> var dropdown = document.getElementById("EditRecordExpected_Outcome"); var selectedValue = dropdown.options[dropdown.selectedIndex].text; if (selectedValue === "Business Insight") { document.getElementById("result").style.backgroundColor = "black"; } </script> Quote Link to comment Share on other sites More sharing options...
NikkiC Posted June 14, 2017 Author Report Share Posted June 14, 2017 I've fixed it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.