Javascript 在Jquery中使用图像不起作用-转义引号
你好,我是jquery的新手 我有wordpress的投票系统 这是一段代码 当Javascript 在Jquery中使用图像不起作用-转义引号,javascript,jquery,wordpress,Javascript,Jquery,Wordpress,你好,我是jquery的新手 我有wordpress的投票系统 这是一段代码 当 $.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response){ if(response!="-1") { el.html("VOTED").unbind("click"); if(response=="null") {
$.post('<?php echo admin_url('admin-ajax.php'); ?>', data,
function(response){
if(response!="-1") {
el.html("VOTED").unbind("click");
if(response=="null") {
alert("A vote has already been registered to this IP address.");
} else {
$("#votecounter").html(response);
alert("Thanks for your vote.");
}
但是当我使用
这个我用这个它不起作用
el.html("<img width="584" height="455" src="/wp-content/uploads/2012/12/Hydrangeas.jpg" class="attachment-large wp-post-image" alt="Hydrangeas">")
el.html(“”)
您需要转义您的引用。堆栈溢出上的语法高亮显示甚至显示文章的格式不正确
例如:
el.html("<img width=\"584\" height=\"455\" src=\"/wp-content/uploads/2012/12/Hydrangeas.jpg\" class=\"attachment-large wp-post-image\" alt=\"Hydrangeas\">")
el.html(“”)
试试:
el.html('<img width="584" height="455" src="/wp-content/uploads/2012/12/Hydrangeas.jpg" class="attachment-large wp-post-image" alt="Hydrangeas">')
el.html(“”)
我不会告诉用户如何绕过投票系统。不要说“这个IP已经投票了”,只需写“你已经投票了”。多色字符串突出显示是有问题的标志。在SO中发布问题之前,请检查JSLint的语法、控制台错误、文档等。如何在el.html()add.class之后添加类
el.html('<img width="584" height="455" src="/wp-content/uploads/2012/12/Hydrangeas.jpg" class="attachment-large wp-post-image" alt="Hydrangeas">')