Add CSS Class to link based on Character Count with jquery
- by Wes
I have links that load dynamically onto a background to make them look like buttons. Some of the links take up two lines and some of the links take up 1 line. Eithe way they need to be vertically centered.
My plan to to append a class based on the number of characters and then adjust the padding from there.
So if the link's text is 25 characters (including spaces) or less - append class 'small'
if the link's text is greater than 25 characters - append class 'large'
How would I go about doing this with jQuery?