[英]Why doesn't my String/selector concatenation work?
誰能告訴我為什么這行不通:
var cfHTML = '<div class="touch-feild" onclick="showPreview('+$(this).find('.feed-thumb')+')"></div>';
我收到“未捕獲的SyntaxError:意外的標識符”
希望有人可以在這里幫助我。 我想這肯定是一個非常簡單的問題:-)
謝謝
它認為您要完成的操作是您的中的onclick="showPreview($(this).find('.feed-thumb'))"
。
var cfHTML = '<div class="touch-feild" onclick="showPreview($(this).find(\'.feed-thumb\'))"></div>';
$(this).find('.feed-thumb')
將給你的jQuery對象不是字符串。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.