I just can not wrap my head around on why this happens. In here it works as I think it should work: http://jsfiddle.net/TD2Yp/5/
The console brings Object {filetype: "first"}
as a first log. But under my demo link:
http://beta.us.lt/demo/ where I do exactly the same in the console:
$("#types").data("filetype")
- works as it brings back the filetype, but:
$("#types").data() brings:
TypeError: Cannot call method 'split' of undefined
Still not sure what is the difference between these two different contexts or how I could check what data holds the element under the demo link.
You are using very old version of jQuery 1.3.2
Read .data()
In jQuery 1.4.3 setting an element's data object with .data(obj) extends the data previously stored with that element. jQuery itself uses the .data() method to save information under the names 'events' and 'handle', and also reserves any data name starting with an underscore ('_') for internal use.
Prior to jQuery 1.4.3 (starting in jQuery 1.4) the .data() method completely replaced all data, instead of just extending the data object. If you are using third-party plugins it may not be advisable to completely replace the element's data object, since plugins may have also set data.