Jump to content

Recommended Posts

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

Link to post
Share on other sites

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> 

 

Link to post
Share on other sites

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>

 

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...