Hide First Word of Span by using Css or Jquery

I want to hide first word(ILS) from the span by using css..I have a div which have no class and inside that div there is a span...I just want to hide this word(ILS) from the span...Please guide me where i am wrong

Text displayed like this on the site:

enter image description here

Here is my div:

<div class="purhstdtls-delvry-timesec">
  <h5>Test Sample</h5>
  <div class="purchase-price"></div>
  <div>Some Text Here</div>
  <div>
        <span>ILS 0.10 / ?????</span>
  </div>
</div> 

Css :

.purhstdtls-delvry-timesec>div:nth-child(4)>span:first-word{
   display:none;
}

Answers:

Answer

Preferably you add an id to the span or already send the right thing in the backend but: You can just replace the content.

<head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script>$(document).ready(
function(){
$('span').text($('span').text().replace('ILS',''));
});
</script>
</head>


    <div class="purhstdtls-delvry-timesec">
      <h5>Test Sample</h5>
      <div class="purchase-price"></div>
      <div>Some Text Here</div>
      <div>
            <span>ILS 0.10 / ?????</span>
      </div>
    </div>

It's a dirty solution but it'll work.

Answer

You can add wrapper around your required text to be hidden in your case ILS, Try following Code

$(document).ready(function(){
    $("span:contains(ILS)").each(function(k,v){
        var d = $(v).html();
        d = d.replace("ILS", "<div style='display:none'>ILS</div>");
        $(v).html(d);
    });
});

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us Javascript

©2020 All rights reserved.