Cameron Bass Cameron Bass - 1 year ago 69
jQuery Question

jquery - change text color

I'm new to Jquery and I'm trying to get started by simply changing the color of the font when I hover over it. I thought that I put the right code in but it's not working? can someone help me get this going?




<p class="modal"><%= @subscriber.last_name %></p>


//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

This is all my code. I just wanted to keep it simple at first.

Answer Source

Andros Rex's method works perfectly - however you may actually want something more like this instead - it changes the color back to the previous color when the mouse is no longer over the element.

    function() {
        var old;
            function() {
                old = $(".modal").css("color");
            function() {