Let's take a quick look at three more features in Spry 1.4. First lets take a look at remove and addClassName. These two functions will either remove, or apply, a CSS style to an element. So consider this element:
<div id="test">This is the test content that will be changing.</div>
To apply a CSS style to this element, you can use this code:
Spry.Utils.addClassName('test','someCSS');
Obviously removeClassName will remove the item.
The last new function I'll discuss is getNodeText(). As you can probably guess, it returns the text inside an element. Using the same div above, the following code:
var str = Spry.Utils.getNodeText($('test'));
will set str equal to: This is the test content that will be changing.
For an example of all three, check out this demo Be sure to view source.
Archived Comments
Sweet moves Ray, I've been messing with Google Maps and I really thing I could get some use from Spry. I gots to brush up on my javascript.
Trust me - my JS was rusty as well. AJAX is bringing it back.
I never really liked JavaScript - I just can't stand the syntax. But now I'm going to have to really bone up on it.
@lola
Shameless jQuery plug
I HATED, HATED JavaScript also. Then I found jQuery and it brought back the fun! It's easy to learn, powerful and the community is awesome. Take a look if you haven't heard of it.
jquery.com
Y'know, I really disliked the initial releases of Spry... the stuff it made easy wasn't really relevant to me, and required some ugly HTML.
But now they're getting into some things I can really use, and I'm slightly excited.
I am having trouble with a condition (www.sigmanuepsilondelta.com.... This is only part of a site that is for people to use to predict the bowl games, and I want to make it so that if their prediction is right, the text is green, and if not red. Any suggestions on how to go about doing this?
You want to use conditionals. Here is a slightly older example of that:
http://ray.camdenfamily.com...
It is pretty simply in Spry.