Javascript examples for jQuery Method and Property:remove
loop remove only certain child nodes
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.4.min.js"></script> <script type="text/javascript"> $(window).load(function(){/* www. j a v a2s . c om*/ if ($('p').has('#unique')) { console.log($('p').html()); $('p').find('br').remove(); console.log($('p').html()); } }); </script> </head> <body> <p> <br> <br> <img id="unique" src="http://www.java2s.com/style/demo/Safari.png"> <br> </p> </body> </html>