javascript - JQuery to find LI by text and UL by Class -
i working list in sharepoint 2013 creates unordered list dynamically on mouseover (the list item ecb familiar sharepoint).
the class name given has spaces added after at, 1 additional space each menu item. i'm not sure if affects class property value in jquery why i'm using begins notation.
i needing hide several menu items , i'm not getting alerts in debug i'm thinking syntax off.
i'm using this:
if($('ul[class^="ms-core-menu-list"] li[text="view item"]') ! == null) { alert('f'); } else { alert('no f'); } i not alerts either syntax wrong , need assistance or menu item isn't created when code executes, in case i'm wondering how possible @ these menu items using jquery i'm unable deploy code in environment. i've looked @ number of blogs on past few days nothing recommended comes close working me.
thank you
if you're trying find out if page contains li tags text "view item" children of ul tags class "ms-core-menu-list" can use selector:
$('li:contains("view item")', $('ul.ms-core-menu-list')).length; in context of example:
if($('li:contains("view item")', $('ul.ms-core-menu-list')).length) { alert('f'); } else { alert('no f'); }
Comments
Post a Comment