Manipulating the the HTML requires getting and setting the values of attributes for the different elements. jQuery usually uses the same function to do get and set a property. When you want to set a value, you will pass it to the function as a string, or sometimes integer. get a value, you don't.

The various methods are described in the Attributes method of the jQuery 1.4 cheatsheet. Here are some examples




  • Get HTML
  • Set HTML
  • Get title
  • Set title
  • Get css color

Do live:

Set the css color to 'blue'

Set the redbox height

Set the value of text_input

Set the HTML of redbox to the value of text_input

This paragraph has a id: "example1" title: "example title" and the color is defined.

class = box
id = redbox