Category Archives: javascript

HTML Select list of US States

I was working on my project and i needed a select list of US states. I googled and found the list here.
But this was not what i was looking for. I needed the list with US state names as values. So i created the list and thought it would be nice to share with people [...]

Also posted in WEB 2.0 | Tagged , | Leave a comment

Attaching information to a dom node using javascript

I had a requirement in my project where i had to attach some information to a dom node using javascript.
I created some checkboxes using DOM’s createElement method. Now the task was to assign userId information to each checkbox.
I knew that i can’t use the userId attribute for the “input” tag.

1
<input id="chk1" type="checkbox" />

The above code [...]

Also posted in WEB 2.0 | Tagged , | 1 Comment

Changing onclick event of an tag using javascript

I was doing some dom manipulation in my code when i got stuck with this issue.
“ISSUE” :- I had to assign a js function to onclick event of img tag.
I was assigning the function to the onclick event like this
document.getElementById(’buttonImg’).onClick=”postComment(’1′)”;
To my surprise this thing didn’t worked. I was following the rules and this is perfecly [...]

Posted in javascript | Tagged , | Leave a comment