javascript - add or remove css file from the page using jquery -
i wants delete css file page on page load after topheader div closing except 1 inside top header have written jquery code not working please can help?
<div class="topheader" style="background-color: #0a5fa2 !important"> <div class="stripe"> <div class="row"> <div class="col-md-4"> <p class="needhelp">need help?</p> <p class="helpdesk">hotel reservation helpdesk (working hours 8pm)</p> </div> <div class="col-md-8"> <div class="wprtopicon"> <span class="whybookwith">why book ?</span> <div class="securetrans">secure <br> transactions</div> <div class="bestrategurtee">best price <br>guaranteed</div> <div class="bestoffer">best offer</div> </div> </div> </div> </div> <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates-common/106/css/newheader.css"> </div>//topheader closed <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates- common/106/css/newheader.css"> <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates-common/106/css/newheader.css"> <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates-common/106/css/newheader.css"> <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates-common/106/css/newheader.css"> <link rel="stylesheet" type="text/css" href="http://wotfly.com/templates-common/106/css/newheader.css"> <script> $(function() { var count = 1; $('link').each(function() { var href = $(this).attr('href'); if (href == "http://wotfly.com/templates-common/106/css/newheader.css") { if (count > 1) { $(this).remove(); } count++; } }); }); </script> remove function not deleting css file page please help?
you can use :not(:first)
exclude first link , remove rest
$("link[href*='http://wotfly.com/templates-common/106/css/newheader.css']:not(:first)").remove();
Comments
Post a Comment