Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图从我的 twitter 分享按钮中获取我的数据文本的值,我想出了这个代码:
var twitterTitle = $('.twitter-share-button').attr("data-text"); alert(twitterTitle);
但它是未定义的警报。有任何想法吗?
应该
var twitterTitle = $('.twitter-share-button').data("text");