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.
就文档而言,还没有想出太多。如何找到具有特定类名且也具有指定属性值的元素。?
function go_to_page(page){ $('.page_link[longdesc=page]').addClass('.active_page'); }
我从这里得到了例子。尝试自己测试它,它似乎没有工作。
function go_to_page(page){ $('.page_link[longdesc=' + page + ']').addClass('active_page'); }
您的语法有一些错误,请尝试:
function go_to_page(page){ $('.page_link[longdesc='+page+']').addClass('active_page'); }
类通常不以点开头(仅在选择器中而不是名称中)