MA-2016
MA-2016

Reputation: 663

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;
}

Upvotes: 1

Views: 3542

Answers (3)

Alok Kumar
Alok Kumar

Reputation: 1

Using CSS we can try this to free up some space of div in mobile view:

.navitem1{
    visibility: hidden;
    font-size: 1px;
}

Upvotes: 0

Alpesh Jikadra
Alpesh Jikadra

Reputation: 1722

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);
    });
});

Upvotes: 0

Javerage
Javerage

Reputation: 21

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.

Upvotes: 2

Related Questions