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.
我有以下内容:
<li id="abc">x</li>
如何使用 JQuery 检查该元素是否存在,如果存在则执行以下函数?
contentControls(ContentButtonAction.Init);
if ($('#abc').length) { contentControls(ContentButtonAction.Init); }
您可以使用以下内容:
if( $('#abc').length ) { contentControls(ContentButtonAction.Init); }