-1

I want to change the color of my Bulma button, in my Rails app. Those button are use to filter results on a search page.

So far i did the following, but it is not working the color is not changing:

<%= link_to request.params.merge(category: "9"), class: "button is-rounded", id: "ButtonId" do %>
                                <i class="fas fa-thermometer-full"></i><%= t "services.title" %>
                                <% end %>

<script>
$('#ButtonId').click(function() {
$(this).addClass('has-background-danger');
});
</script>
Tomas
  • 249
  • 3
  • 13

1 Answers1

0

I was not charging Fontawesome correctly, the following solve my problem:

First,

  yarn add @fortawesome/fontawesome-free

After in app/javascript/packs/application.js

   import "@fortawesome/fontawesome-free/js/all";

And in app/javascript/css/main.scss

 @import '@fortawesome/fontawesome-free';

Finally in app/javascript/packs/application.js, i removed

window.jQuery = $;
window.$ = $;
Tomas
  • 249
  • 3
  • 13