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:
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;
}
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.
You can play with text-indent and overflow:
.purhstdtls-delvry-timesec>div:nth-child(4) { text-indent: -25px; overflow:hidden; }
<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>
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);
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.