我的代码就是这个
var call_from='fb_test'
jQuery('.test').html("<img src=\"https://wwww.socialappshq.com/images/socialapps/loading.gif\" height=\"15\" width=\"15\" id=\"loading_image_\" + call_from + \">");
但它没有正确连接请帮帮我
答案 0 :(得分:2)
使用javascript编写html时,首选'
括起字符串,"
括起属性值
var call_from='fb_test'
jQuery('.test').html('<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '">');
答案 1 :(得分:1)
请尝试以下代码。
var call_from='fb_test';
var yourHtml = '<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '"/>';
jQuery('.test').html(yourHtml);
答案 2 :(得分:1)
对于JavaScript
中的连接,请尝试使用
var call_from='fb_test'
jQuery('.test').html("<img src=\"https://wwww.socialappshq.com/images/socialapps/loading.gif\" height=\"15\" width=\"15\" id=\"loading_image_\"" + call_from + "\">");
答案 3 :(得分:0)
var yourHtml = '<img src="https://wwww.socialappshq.com/images/socialapps/loading.gif" height="15" width="15" id="loading_image_' + call_from + '"/>';
jQuery('.'+call_from).html(yourHtml);