如果知道是哪一个div了 如果id="nav" 获取class:$("#nav").attr("class")如果class="nav" 获取id: $(".nav").attr("id");也可以用 jq后期版本的 prop 和 attr一样的用法望采纳,谢谢!