TheFilmGod Posted April 6, 2009 Share Posted April 6, 2009 Using jquery, how can I select an element whose inner html is == 'login' $('#toolbar .header ul li a').text('login') Thanks! Link to comment https://forums.phpfreaks.com/topic/152851-select-an-element-by-inner-html/ Share on other sites More sharing options...
irvieto Posted April 6, 2009 Share Posted April 6, 2009 in Jquery, the .html() method gives you the inner text. Example: <div id="hello">World!</div> <script type="text/javscript"> var div_content = $("#hello").html(); window.alert(div_content); /*displays: World!*/ </script> Link to comment https://forums.phpfreaks.com/topic/152851-select-an-element-by-inner-html/#findComment-802759 Share on other sites More sharing options...
TheFilmGod Posted April 8, 2009 Author Share Posted April 8, 2009 Thanks for the effort, but I'm not interested in obtaining the inner html. Instead, I'm interested in SELECTING an element according to the inner html value. Link to comment https://forums.phpfreaks.com/topic/152851-select-an-element-by-inner-html/#findComment-804107 Share on other sites More sharing options...
darkfreaks Posted April 8, 2009 Share Posted April 8, 2009 hope this helps: http://jquery-howto.blogspot.com/2009/01/how-to-select-innermost-element-with.html Link to comment https://forums.phpfreaks.com/topic/152851-select-an-element-by-inner-html/#findComment-804113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.