[英]JQuery Formatting Issue
I can't get this to work for the life of me. 我无法让它为我的一生工作。 The URL concat messes up. URL concat混乱了。 The answer doesn't seem obvious... 答案似乎并不明显...
function(data){
$('#dataDisplay').prepend("<img src='http://url"+data+"moreurl' />").fadeIn("slow");
});
Firebug throws missing end argument errors. Firebug抛出缺少的结束参数错误。
function xx(data){
$('#dataDisplay').prepend("<img src='http://url"+data+"moreurl' alt='' />").fadeIn("slow");
});
you should name your function as XX for example and i think you must add the ALT attribute 您应该将函数命名为XX,例如, 我认为您必须添加ALT属性
Try string replacement using a placeholder instead and stop worrying about escaping. 尝试使用占位符代替字符串,并不必担心转义。
var img = '<img src="http://url{data}moreurl" />';
img = img.replace("{data}", data);
$('#dataDisplay').prepend(img).fadeIn('slow');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.