Avatar of Refael
RefaelFlag for United States of America asked on

jQuery add dotted lines

Hi Guys,

I have few UL lists in a page.
Here is the code below including the jQuery. What i am trying to do is fill in the gap between the end of "href" text to the "span" with dotted line" suc has in the screenshot attached.

The HTML

<div id="poi">

    <ul>
       <li><a href="#">Lorem Ipsum is simply dummy  <span>&raquo;</span></a></li>
      <li><a href="#">Lorem Ipsum is  <span>&raquo;</span></a></li>
      <li><a href="#">Lorem Ipsum is simply <span>&raquo;</span></a></li>
    </ul>

    <ul>
       <li><a href="#">Lorem Ipsum is simply dummy  <span>&raquo;</span></a></li>
       <li><a href="#">Lorem Ipsum is  <span>&raquo;</span></a></li>
      <li><a href="#">Lorem Ipsum is simply <span>&raquo;</span></a></li>
    </ul>

</div>

Open in new window


$(document).ready(function() {
	var poiList = $("#poi ul");
	
	$(poiList).each(function() {
		var poiListWidth = ($(this).width());
		$(this).css({'width': poiListWidth+10 });	
	});	
});

Open in new window


dotted lines per distance between end of text to span
jQuery

Avatar of undefined
Last Comment
Rob

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rob

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Refael

Hi tagit
Thank you. I managed to do the same using simply CSS and it works just as good as your jQuery solution. Thank you now i know how to when i need to use jQuery :-)
Rob

Please post your solution too as it would be a good resource to have
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes