The problem is when you call $(this) every time a new jQuery wrapper will be created, so what every you added to the previous object won't be available in the new object.
You can test it using $(this) == $(this)
which will return false
.
The correct way will be is to use the data api
$('ul').click(function () {
console.log('test', $(this) == $(this));//will be false since both the times different objects are returned
console.group('Using cached object')
var $this = $(this);//here we use a cached instance of the jQuery wrapper, this will work as long as you have a reference to $this - but is the wrong way
$this.myul = {
'date': '28 april'
}
console.log($this.myul);
console.groupEnd()
console.group('Using data api')
$(this).data('myul', {
'date': '28 april'
});
console.log($(this).data('myul'))
console.groupEnd()
})
Demo: Fiddle