Rusty Javascript

Leave a comment Standard

Today I was having a total brain fart on my javascript abilities. So after some nifty google searching I was able to refresh my memory. If I’ve forgotten I’m sure you will too.

Declare A String

var result = new String(“my text goes in here”);

Substring Function

result.substring(0, 3); //pulls the first 3 characters off the string

Find All Child Field Of A DIV Layer

var children = document.getElementById(“div_id_here”).childNodes;

For Each Loop

for (var i in children) {
alert(children[i]);
}

Is Numeric Check

if (!isNAN(document.getElementById(“div_id_here”).value))
alert (“This really is a number!”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s