Your code and what you are trying to do has nothing to do with jQuery
really.. it's all simple JS object stuff (http://www.google.com/search?
q=javascript+associative+array), with that pointed out
var d = {"one": 1, "two": 2, "three": 3};
d["four"] = 4;
would result in d being:
{ "one": 1, "two": 2, "three": 3, "four": 4 }
On Jul 14, 11:53 am, yasmine wrote:
> Hi, am very new to jquery and I want to do something that I suppose is
> very easy but I can't figure out how to do it
> If I have something like this:
> var d = {one:1, two:2, three:3};
>
> and I want to add a new item to d, how can I do it?
>
> I have looked up the documentation and found the function called data
> (name, value) and I tried doing this
> $(d).data("four",4); but it wasn't added
>
> Thanks in advance