Rails 4 - Simple Form - Jquery - How to add a class to an option in a selectbox
<p>I am so confused - your help would be much appreciated. Could one kindly tell me how to add a class to a specific option in a select box.</p>

<p>As per the image, i would like to add a class only to the option: <code>&lt;option value="4"&gt;both X men &amp; X women&lt;/option&gt;</code> but i am unsure how</p>

<p>_form.html.erb</p>

<pre><code>&lt;%= simple_form_for [@user, @social] do |f| %&gt;
  &lt;%= f.error_notification %&gt;

  &lt;div class="form-inputs"&gt;
    &lt;%= f.association :category_quantitygender, collection: CategoryQuantitygender.all, prompt: "select a category", label: "Quantity Gender Selection", input_html: { class: 'category_select' } %&gt;
  &lt;/div&gt;

  &lt;div class="form-actions"&gt;
    &lt;%= f.button :submit %&gt;
  &lt;/div&gt;
&lt;% end %&gt;
</code></pre>

<p>i tried the below but no luck:</p>

<pre><code>$(document).ready(function() {
  $('#social_category_quantitygender_id').addClass($('here').val() == 4));
});
</code></pre>

<p><a href="https://i.stack.imgur.com/ZyrUl.png" rel="nofollow"><img src="https://i.stack.imgur.com/ZyrUl.png" alt="enter image description here"></a></p>