2
You can do this using CSS and jQuery. Just include the numbers in one span
classy .vermais
and the code does the rest:
$(document).on("click",".vermais span", function(){
$(this)
.text($(this).data("num"))
.removeClass("numesc");
});
$(".vermais").each(function(){
var numtel = $(this).text().split('-');
var numesc = numtel.shift()+"-<span class='numesc' data-num='"+numtel.pop()+"'>...ver mais</span>";
$(this).html(numesc);
});
.vermais{
display: inline-block;
position: relative;
}
.numesc{
font-size: .9em;
cursor: pointer;
text-decoration: underline;
}
.vermais .numesc:hover{
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="vermais">(79) 98567-1234</span>
<br />
<span class="vermais">(79) 98567-5678</span>
how far you’ve come with your code
– Leandro Angelo
Friend, you can use css to hide part of the string, using the width and overflow properties. And with javascript change this css to show the string.
– Drealler