0

I have the following code in a Script Editor webpart:

<div id="dv1">
<input type="radio" name="chook" value="0" onclick="displaychook(this);">Supply chain modelling
<br/>
<input type="radio" name="chook" value="1" onclick="displaychook(this);">Process simulation
<br/>
</div>

I want to apply style to the "name" elements to change the font color to white. I tried the following code:

.input[name="chook"] { color;white!important; }

but it doesn't work for you. can you please give me a clue?

closed as off-topic by Christoffer, Gautam Sheth, moe, Gaurravs, Nadeem Yousuf Feb 6 '18 at 11:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions not specific to SharePoint are off-topic here, but can be asked on Stack Overflow." – Christoffer, Gautam Sheth, moe, Gaurravs, Nadeem Yousuf
If this question can be reworded to fit the rules in the help center, please edit the question.

0

Put the text in a label and style the label like this:

<style>
  label {color:white;}
</style>
<div id="dv1">
  <input type="radio" name="chook" id="rb1" value="0" onclick="displaychook(this);">
  <label for="rb1">Supply chain modelling</label>
  <br/>
  <input type="radio" name="chook" id="rb2" value="1" onclick="displaychook(this);">
  <label for="rb2">Process simulation</label>
  <br/>
</div>

I've added id:s to your input fields for this purpose. Also, when you put a dot before the name in a css class, you indicate that you target elements with a certain class. In this case you're targeting a certain element type. So no dot before the class anme.

The above example will of course make all labels on the page white. If you only want labels corresponding to some input elements you can use a class like this:

label.chook

This targets only labels with the class chook. Here's how to implement it:

<style>
    label.chook {color:white;}
</style>
<div id="dv1">
    <input type="radio" name="chook" id="rb1" value="0" onclick="displaychook(this);">
    <label class="chook" for="rb1">Supply chain modelling</label>
    <br/>
    <input type="radio" name="chook" id="rb2" value="1" onclick="displaychook(this);">
    <label class="chook" for="rb2">Process simulation</label>
    <br/>
</div>

Not the answer you're looking for? Browse other questions tagged or ask your own question.