JQuery Access ID and Class

From CoderLearner
Jump to: navigation, search

CSS ID and CLASS

Access jQuery vs. CSS

Define CSS Class


.nav {
  margin-top: 2em;
  padding-top: 1em;
  border-top: solid thin navy
}

.nav img { float: right }

HTML Element

<div class="nav">
</div>

<div class="nav">
   <img src="something.gif"></a>
</div>

Define CSS ID

#uptop {
  color:red;
}

span#firststep {
  color:blue;
  background:none;
}

span#secondstep {
  color:black;
}

HTML Element

 <p id="uptop">Great Leader</p>
 <span id="firststep">First Step</span>

JQuery ID and Class

   $('div.nav').html('.....');  // access class
   $('span#secondstep').html("..second");
   

<seo metagenerator="jquery tutorial" title="Jquery/Ajax" metakeywords="jquery greater,jquery gt, jquery lt, less then, odd jquery,jquery find element, even jquery,jquery event, jquery mouse click, jquery double click, jquery hover, jquery string, jquery array, jquery button, jquery attriubtes" metadescription="jquery button, jquery attriubte, jquery example, jquery tutorial, jquery sample"/>