html - Javascript, remove class of DIV based on value of Link's innerHTML -


i looking javascript. have piece of html follows:

<div class="keepshopping floatright greenbutton">     <a href="http://www.xyz.com">click here keep shopping</a> </div> 

i trying remove class "greenbutton div once link inside has no text in html, end result should this:

<div class="keepshopping floatright">     <a href="http://www.xyz.com"></a> </div> 

i have been unsuccessfully trying following code, runs @ end of page load/refresh:

<script type="text/javascript">     $(".keepshopping").each(function() {     if($("a", this).html == "") {         $(this).removeclass("greenbuttonlge");     } }); </script>     

any suggestions / ideas welcome! thank in advance help!

html function, not property. write this..

<script type="text/javascript">     $(".keepshopping").each(function() {     if($("a", this).html() == "") {         $(this).removeclass("greenbuttonlge");     } }); </script> 

Comments