Search code examples
javascriptcommonjs

add a change color in js


I am trying to add a function into common.js that will change the background color of a button. Is this possible? thanks guys.

$('#api_search').style.backgroundColor('#e4e4e4');

Solution

  • $('#api_search').css("background","#e4e4e4");
    

    or

    $('#api_search').attr("style","background:#e4e4e4");