[Last Call] Learn how to a build a cloud-first strategyRegister Now


Why isn't this css class being added to my footer tag via JQuery.

Posted on 2011-10-15
Medium Priority
Last Modified: 2012-06-27

Here is my HTML5 and PHP
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8"/>
<link rel="stylesheet" href="css/mycss.css"/>
<script src="jquery-1.6.2.min.js"></script>
<script src="myjs.js"></script>
	$firstname = "Ben";
	$secondname = "Benn";
	$actualname = "";
	const MYNICKNAME = "benny";
	define("MYCONSTANT","Benny Bong");
	if ($firstname === $secondname) { echo "They are the same"; } else { echo "They are different"; }
	$actualname = (isset($firstname)) ? $firstname : $secondname;
	echo $actualname;
<header class="header">


Open in new window

This is my external css file
.header {
	font-style : italic;

	font-style : bold;

Open in new window

This is my external js file.

Open in new window

Question by:AivsCoder
LVL 16

Expert Comment

ID: 36974976
The JQuery function will be applied to a div with a specific id or class.
You need to creare a div with an id "footer", and then use:

Open in new window

Pay attention to the '#' symbol.
More on JQuery selectors.
LVL 84

Accepted Solution

Dave Baldwin earned 500 total points
ID: 36975210
Possibly because it's wrong.  Should be "font-weight".
	font-weight: bold;

Open in new window

LVL 38

Expert Comment

by:Tom Beck
ID: 36975766
I don't have a solution to provide, I'm just weak on jQuery and trying to learn, so I'd like to ask @HagayMandel a question. Does jQuery recognize HTML5 tags at all? Because the author's jQuery should work if it did.
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!

LVL 25

Expert Comment

by:Kyle Hamilton
ID: 36976223
jquery recognizes html5 tags. But IE < 9  doesn't.  

I commented out your php - there is an error preventing the page from displaying in IE.

Here is a working file for all browsers but IE < 9:
addClass jquery
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 36976228
Here's the example with the PHP code left in:

addClass jquery (including original PHP)
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 36976231
(could just be the php configuration on my server - but I don't think you're supposed to use const as a global variable)


Author Closing Comment

ID: 36977471

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

834 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