我需要在采用代码中使用以下 if 语句,但如果它存在则无效。有什么方法可以让我做同样的事情吗?
var ele = new Element('li').adopt(
new Element('span.title', {text:row.title}),
new Element('span.subtitle').adopt(
// Need this to work, but its invalid where it is atm
if(row.subtitle = 1)
{
new Element('img', {src:'images/subTitle.png'})
}
),
new Element('span.bold', {text:row.bold}),
);
ele.iject(...