+ Start a Discussion
RocketRocket 

Plain Jquery

Hi Friends,

 

I have simple jquery and I am only using Html page and not any visual force page.I am trying to figure out why addclass fucntion is not firing when  the document get's loaded.I was expecting that css will be applied to the paragraph tag when the script gets executed.That is not happening.I tried putting alert in the same section before and after addclass method and I can see that alert getting executed so it means docoument.getready function is getting executed but addclass is not executing.Can somebody please help?

 

<!DOCTYPE html>

<html>
<head>
<style>
.highlight
{
font-weight:bold;
font-size:xx-large;
background-color:green;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function()
{

alert('Yes');
$('p').addclass('highlight');
alert('great');
</script>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<div>This is some important text!</div>
</body>
</html>

sfdcfoxsfdcfox
"addClass", not "addclass". Javascript is case sensitive.