我有一个简单的JQuery语句...我的问题是,为什么在这个世界中有一个失败?为什么这个变量不能在JQuery中正确传递
让我们假设变量colorAttribute
是color
$(thisCLass).css("color", '#'+hex); // Works when written
$(thisCLass).css(colorAttribute, '#'+hex); // Works with variable
$(thisCLass).css({ "color" : '#'+hex }); // Works when written
$(thisCLass).css({ colorAttribute : '#'+hex }); // Does not Work with variable
任何想法,为什么一个失败?
谢谢大家谁这么快回答!我希望我能接受你所有的答案...... – VIDesignz