views:

13

answers:

2

I could not understand what this javascript line does.

chkBox.setAttribute("CheckList", range);

What is the "CheckList" attribute is used for?

+1  A: 

There's no defined attribute called "CheckList" for input elements. Wherever that code is, it's setting a custom attribute on the element that it will likely access later. Some people choose this in favour of creating a global variable, but really you should stick to expando properties (if you want to avoid global vars), for example:

chkBox.CheckList = range;

In Internet Explorers before version 8, setAttribute incorrectly maps to properties instead of attributes anyway.

Andy E
+1  A: 

I could not find such attribute on W3, it looks like the programmers has tried to set a custom attribute eg:

<input type="checkbox" CheckList="something" />
Sarfraz