[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

jQuery - get text inside span to align left

Posted on 2013-01-24
2
Medium Priority
?
543 Views
Last Modified: 2013-01-24
Using jQuery - how do I get the text inside of a span to align left?
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Accepted Solution

by:
soupBoy earned 2000 total points
ID: 38815867
By default, spans are inline elements and should be aligning left.  

Are you trying to override a css rule?
This could be done easily by css, all JQuery would be doing would be injected css inline...

//using JQuery to build your css
$('.targetSpan').css({
  display: 'inline-block',
  textAlign: 'left'
});

Open in new window


/*it is better to do it like this*/
.targetSpan{
  display: inline-block;
  text-align: left;
}

Open in new window

0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 38815892
I went with:

 $('span[id*="lblDetails"]').css('text-align', 'left');

Maybe not best practice, but more fun with jQuery.  : )
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The most up-to-date version of this article is on my Blog https://iconoun.com/blog/
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question