dynamically setting properties in uploadify

后端 未结 2 1382
滥情空心
滥情空心 2020-12-19 22:27

is it possible to add a new property to a previously declared object? Here is some code to clarify (with the uploadify jquery plugin):

$(\'#featuredimageuplo         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-19 23:33

    Yes it is possible to add properties (dynamic or otherwise) to an existing Javascript object). You can just use the [] operator to add a dynamic property to an object. For example:

    var key = 'foo';
    var obj = {param: 'value'};
    obj[key] = 'bar';
    alert(obj.foo); // bar
    

提交回复
热议问题