Can you provide the setup for the RSS feed? If you know that the feed will
always be links like this:

> <div id="title">
>         <a href="123.html"><b>One Two Three</a></b></div>
>         <a href="456.html">four five six</a> </div>
>         <a href="789.html">seven eight nine</a> </div>

And you just want the first link to be bold? Then you could do this:

$('#title a:eq(0)').wrap('<b></b>');

That line says "wrap the first child in a bold tag.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Monday, November 12, 2007 10:52 AM
To: jQuery (English)
Subject: [jQuery] Re: How to make the first word bold.


Somebody else probably has a more consice method but you could try something
like this

var mystring = "One Two Three"; //replace with your string var stringarray =
mystring.split(" "); var firstword = mystring.split(" ")[0]; myarray =
jQuery.grep(stringarray, function(n, i){
      return (i > 0);
});
$("div#title a").append("<strong>" + firstword + "</strong>
").append(myarray.join(" "));


On Nov 11, 8:56 pm, Viktor Tarm <[EMAIL PROTECTED]> wrote:
> I am trying to make the first word of a sentence (a title from a 
> generated feed) bold.
>
> TURN THIS:
>
> <div id="title">
>         <a href="123.html">One Two Three</a> </div>
>
> INTO THIS:
>
> <div id="title">
>         <a href="123.html"><strong>One</strong> Two Three</a> </div>
>
> I sure there is a way to do with jQuery, but I can't quite figure it 
> out. I have tried something like this, with no luck:
>
> $("#title.a").contents(0).wrap("<strong></strong>");
>
> Any help would be greatly appreciated.


Reply via email to