thanks for your reply. However, it doesn't work, the variable newwidth return nothing.
the following works: var obj = { width: 300, div: 'testdiv', func: function () { var newwidth = 300; $('#'+this.div).animate({width:newwidth+'px'}, 1000); } } the following doesn't: var obj = { width: 300, div: 'testdiv', func: function () { var newwidth = this.width; $('#'+this.div).animate({width:newwidth+'px'}, 1000); } } On Jul 17, 9:13 am, Karl Swedberg <[EMAIL PROTECTED]> wrote: > On Jul 16, 2008, at 6:03 PM, psdp wrote: > > > > > I have a value stored in an object, and now i want to pass it to a > > jquery function, please help: > > var obj = { > > width: 300, > > div: 'testdiv', > > func: function () { > > var newwidth = this.width; > > $('#'+this.div).animate({width:newwidth+'px'}, 1000); > > } > > } > > sort of looks like you're doing that already? > > after your object, call the function: > > obj.func(); > > you should also put a semicolon after the last curly brace, just to be > safe. > > --Karl > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com