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.
如果我有一个带有指定背景颜色的内联样式的 div,如何使用 jQuery 获取单击时的颜色值?
$(".myDiv").click(function(){ var myColor = $(this).... }); <div class="myDiv" style="background-color:#8080C0"></div>
$(this).css('background-color')
http://jsfiddle.net/zerkms/eWWXT/