Solved

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

Posted on 2012-03-12
4
172 Views
Last Modified: 2012-06-27
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';

http://www.pouyarebek.com/wdiclass/assignment4/homework4.html
0
Comment
Question by:shampouya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
ansudhindra earned 500 total points
ID: 37712521
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.
0
 

Author Comment

by:shampouya
ID: 37712751
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";
0
 
LVL 13

Expert Comment

by:ansudhindra
ID: 37713284
I personally prefer using jQuery method as there will be a uniformity in coding.
0
 

Author Closing Comment

by:shampouya
ID: 37718486
thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question