Hello I am wanting to use the library dotdotdot
.
I'm printing some descriptions and I don't want the whole message to come out, well the first element that prints does, but the rest don't add the function anymore dotdotdot
.
<?php foreach($listadoOfertas as $listadoOfertas){ ?>
<div class="oferta-empleo">
<img class ="logo-oferta" src="imagen1.png" alt="">
<div class="datos-oferta">
<h2 class="titulo-oferta"><a href=""><?php echo $listadoOfertas['titulo'];?></a></h2>
<p id='parrafo-padding'> <strong>Empresa: </strong><?php echo $listadoOfertas['empresa'];?></p>
<p ><strong>Localidad: </strong><?php echo $listadoOfertas['localidad'];?> <strong>Fecha:
</strong><?php echo $listadoOfertas['fecha_publicacion'];?></p>
<div id="descripcion">
<p><?php echo $listadoOfertas['descripcion_oferta'];?>
</p>
</div>
<script> $('#descripcion').dotdotdot();</script>
</script>
</div>
</div>
<?php };?>
Instead of
id
a class common to all description elements can be used.And in the
script
use the class to iterate through the elements:It should apply to all elements with class 'description';