I am looking for a way to insert a <br /> after only the first 4 or 5 characters in a <div>.
Example:
<div id="wine-name">2008 Cabernet Sauvignon</div>
To display like:
2008
Cabernet Sauvignon
Not sure which would be easier javascript or jQuery. The site is already using jQuery.
Any ideas?
If you are certain that you always want to insert the break after the fourth character, you can do this:
You can see it in action here.
If you want it to instead break after the first word (delimited by spaces), you can do this instead:
You can see this in action here.
EDITed for your comment:
See it here.