Reading and changing values


show more Reading and changing values provides you with in-depth training on Web. Taught by Joe Chellman as part of the jQuery for Web Designers show less
please wait ...

Reading and changing values

Working in jQuery there's going to be many times when you want to find out, in your code, what the contents of something you selected are. Let's look at some ways to do that now. This page has a form, as you can see, and obviously, a lot of other HTML. So first let's look at the stuff that's not in the form. I'm just going to scroll down a little bit here, and here's my header, which I happen to know is replaced by this image over here. Let's take a look at it. So, I'm going to select the header ID, like this, and then I'm going call to the HTML method on it. This will return all the HTML inside that selected element.

Like this. If I want to strip out all that HTML and just see the text, wouldn't you know it, there's a method called text. Now, as you can see, both of these return the HTML or the text with some white space. Depending on which browser you're using you might get differing amounts of white space. This is one area that jQuery does not smooth ou...

Reading and changing values
Video duration: 4m 17s 1h 42m Intermediate

Viewers:

Reading and changing values provides you with in-depth training on Web. Taught by Joe Chellman as part of the jQuery for Web Designers

Subject:
Web
Software:
jQuery
Author:
please wait ...