02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

38<br />

CHAPTER 2 ■ COMMON JQUERY ACTIONS AND METHODS<br />

Figure 2-2. The multiline testing area (shown at the right-h<strong>and</strong> side of the console)<br />

With the multiline testing area, you now need to click the Run button at the bottom to execute the<br />

code. Pressing Enter, as with the single-line test console, will now break to a new line.<br />

Creating New DOM Elements<br />

To create a new DOM element, <strong>jQuery</strong> only needs the tag to be created. For instance, to create a new<br />

paragraph element, you would use the following:<br />

$("");<br />

To add attributes <strong>and</strong> text to this element, you can simply write it out as plain HTML:<br />

$('This is a new paragraph!');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!