Hello I have a static option in my Jquery extension. The option is color:”blue”
$(ele).test({color:”color”});
//I tried this below
var anoption= “color”; $(ele).test({anoption:”blue”});
But it didint work. Is there anyway to serialize another variable into an option name as attempted above?
Objects simply don’t work that way. If you want to set a property of an object where the name of said property is contained in a variable, you must do it using bracket notation. For example,