Link to home
Start Free TrialLog in
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


User generated image
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Refael

ASKER

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 :-)
Please post your solution too as it would be a good resource to have