Why does my javascript statement stop working once I use jquery?

This line in my js file seems to stop working if I try to change my website color from pink to purple (see webpage below):

      document.getElementById("submit").className = 'formButtonPurple';

Who is Participating?
ansudhindraConnect With a Mentor Commented:
you are setting the background-color property of the button in the other 2 functions to pink and blue.

Setting individual styles (or inline styles) gets preference over the css class.

If you try to update the background-color to purple it works check it.
shampouyaAuthor Commented:
Ok these two ways seem to work now. Is there no difference between these two in terms of which one gets preference?

      $(".formButton").css("background-color", "#5959ff");
      document.getElementById("submit").style.background = "#5959ff";
I personally prefer using jQuery method as there will be a uniformity in coding.
shampouyaAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.