[jQuery] Re: How to make the first word bold.

2007-11-13 Thread [EMAIL PROTECTED]

try
script type=text/javascript
$(document).ready(function() {
$('#links a').each(function(){
var mystring = $('this').html();
var firstword = mystring.replace(/(^\w+)/,'strong
$1/strong');
$(this).html(firstword);
})
});
/script


On Nov 12, 12:34 pm, Viktor Tarm [EMAIL PROTECTED] wrote:
 Thank you all for your help.

 Andy, I'm looking to bold the first WORD, of all the links, not the
 first link.

 Karl, I made a simple page to test your code. It looks like this:

 script type=text/javascript src=./src/jquery-1.2.1.pack.js/
 script
 script type=text/javascript
 $(document).ready(function() {
 var mystring = $('#links a').html();
 var firstword = 
 mystring.replace(/(^\w+)/,'strong$1/strong');
 $('#links a').html(firstword);
 });
 /script

 /head
 body

 div id=links
 p class=titlea href=a.htmlone two three four five/a/p
 p class=titlea href=b.htmlsix seven eight/a/p
 p class=titlea href=c.htmlnine ten eleven/a/p
 p class=titlea href=d.htmltwelve thirteen fourteen/a/p
 /div

 This results in changing the content to = the first link's content,
 like so:

 div id=links
 p class=titlea href=a.htmlstrongOne/strong two three four
 five/a/p
 p class=titlea href=b.htmlstrongOne/strong two three four
 five/a/p
 p class=titlea href=c.htmlstrongOne/strong two three four
 five/a/p
 p class=titlea href=d.htmlstrongOne/strong two three four
 five/a/p
 /div

 I'm looking to just make the first word of the link bold (without
 changing the content), like this:

 div id=links
 p class=titlea href=a.htmlstrongOne/strong two three four
 five/a/p
 p class=titlea href=b.htmlstrongsix/strong seven eight/
 a/p
 p class=titlea href=c.htmlstrongnine/strong ten elevan/
 a/p
 p class=titlea href=d.htmlstrongtwelve/strong thirteen
 fourteen/a/p
 /div

 Any ideas?

 Thanks again.

 On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:

  You could also do this with a regular expression. Maybe something
  like this:

  var mystring = $('#title a:first').html();
  var firstword = mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#title a:first').html(firstword);

  --Karl
  _
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

   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.htmlOne Two Three/a
   /div

   INTO THIS:

   div id=title
   a href=123.htmlstrongOne/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.



[jQuery] Re: How to make the first word bold.

2007-11-13 Thread Matt W.

This is the value of this list, I do a convoluted solution using grep
and all I had to do was use shift.  I love how each answer improves on
the previous one.

On Nov 12, 3:48 pm, Wizzud [EMAIL PROTECTED] wrote:
 eg.

 $('#links a').each(function(){
 var me = $(this);
 me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
   });

 or

 $('#links a').each(function(){
 var me = $(this)
, t = me.text().split(' ');
 me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
   });

 etc

 On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:

  Viktor...

  You'd probably need an $.each() on there then.

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of Viktor Tarm
  Sent: Monday, November 12, 2007 2:35 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make the first word bold.

  Thank you all for your help.

  Andy, I'm looking to bold the first WORD, of all the links, not the first
  link.

  Karl, I made a simple page to test your code. It looks like this:

  script type=text/javascript src=./src/jquery-1.2.1.pack.js/
  script
  script type=text/javascript
  $(document).ready(function() {
  var mystring = $('#links a').html();
  var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#links a').html(firstword);
  });
  /script

  /head
  body

  div id=links
  p class=titlea href=a.htmlone two three four five/a/p
  p class=titlea href=b.htmlsix seven eight/a/p
  p class=titlea href=c.htmlnine ten eleven/a/p
  p class=titlea href=d.htmltwelve thirteen fourteen/a/p
  /div

  This results in changing the content to = the first link's content, like so:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=c.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=d.htmlstrongOne/strong two three
  four five/a/p /div

  I'm looking to just make the first word of the link bold (without changing
  the content), like this:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongsix/strong seven eight/
  a/p
  p class=titlea href=c.htmlstrongnine/strong ten elevan/
  a/p
  p class=titlea href=d.htmlstrongtwelve/strong thirteen
  fourteen/a/p /div

  Any ideas?

  Thanks again.

  On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
   You could also do this with a regular expression. Maybe something like
   this:

   var mystring = $('#title a:first').html(); var firstword =
   mystring.replace(/(^\w+)/,'strong$1/strong');
   $('#title a:first').html(firstword);

   --Karl
   _
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

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.htmlOne Two Three/a /div

INTO THIS:

div id=title
a href=123.htmlstrongOne/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.



[jQuery] Re: How to make the first word bold.

2007-11-13 Thread Viktor Tarm

Thanks Wizzud... that's what I was looking for.

I had to wrap window.onload = (function(){try{ ... }catch(e){}});
around the script... not sure why, but it seems to work


On Nov 12, 5:48 pm, Wizzud [EMAIL PROTECTED] wrote:
 eg.

 $('#links a').each(function(){
 var me = $(this);
 me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
   });

 or

 $('#links a').each(function(){
 var me = $(this)
, t = me.text().split(' ');
 me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
   });

 etc

 On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:

  Viktor...

  You'd probably need an $.each() on there then.

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of Viktor Tarm
  Sent: Monday, November 12, 2007 2:35 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make the first word bold.

  Thank you all for your help.

  Andy, I'm looking to bold the first WORD, of all the links, not the first
  link.

  Karl, I made a simple page to test your code. It looks like this:

  script type=text/javascript src=./src/jquery-1.2.1.pack.js/
  script
  script type=text/javascript
  $(document).ready(function() {
  var mystring = $('#links a').html();
  var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#links a').html(firstword);
  });
  /script

  /head
  body

  div id=links
  p class=titlea href=a.htmlone two three four five/a/p
  p class=titlea href=b.htmlsix seven eight/a/p
  p class=titlea href=c.htmlnine ten eleven/a/p
  p class=titlea href=d.htmltwelve thirteen fourteen/a/p
  /div

  This results in changing the content to = the first link's content, like so:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=c.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=d.htmlstrongOne/strong two three
  four five/a/p /div

  I'm looking to just make the first word of the link bold (without changing
  the content), like this:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongsix/strong seven eight/
  a/p
  p class=titlea href=c.htmlstrongnine/strong ten elevan/
  a/p
  p class=titlea href=d.htmlstrongtwelve/strong thirteen
  fourteen/a/p /div

  Any ideas?

  Thanks again.

  On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
   You could also do this with a regular expression. Maybe something like
   this:

   var mystring = $('#title a:first').html(); var firstword =
   mystring.replace(/(^\w+)/,'strong$1/strong');
   $('#title a:first').html(firstword);

   --Karl
   _
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

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.htmlOne Two Three/a /div

INTO THIS:

div id=title
a href=123.htmlstrongOne/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.



[jQuery] Re: How to make the first word bold.

2007-11-13 Thread Viktor Tarm

Thanks a lot Wizzud... works perfectly.

On Nov 12, 5:48 pm, Wizzud [EMAIL PROTECTED] wrote:
 eg.

 $('#links a').each(function(){
 var me = $(this);
 me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
   });

 or

 $('#links a').each(function(){
 var me = $(this)
, t = me.text().split(' ');
 me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
   });

 etc

 On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:

  Viktor...

  You'd probably need an $.each() on there then.

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of Viktor Tarm
  Sent: Monday, November 12, 2007 2:35 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make the first word bold.

  Thank you all for your help.

  Andy, I'm looking to bold the first WORD, of all the links, not the first
  link.

  Karl, I made a simple page to test your code. It looks like this:

  script type=text/javascript src=./src/jquery-1.2.1.pack.js/
  script
  script type=text/javascript
  $(document).ready(function() {
  var mystring = $('#links a').html();
  var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#links a').html(firstword);
  });
  /script

  /head
  body

  div id=links
  p class=titlea href=a.htmlone two three four five/a/p
  p class=titlea href=b.htmlsix seven eight/a/p
  p class=titlea href=c.htmlnine ten eleven/a/p
  p class=titlea href=d.htmltwelve thirteen fourteen/a/p
  /div

  This results in changing the content to = the first link's content, like so:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=c.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=d.htmlstrongOne/strong two three
  four five/a/p /div

  I'm looking to just make the first word of the link bold (without changing
  the content), like this:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongsix/strong seven eight/
  a/p
  p class=titlea href=c.htmlstrongnine/strong ten elevan/
  a/p
  p class=titlea href=d.htmlstrongtwelve/strong thirteen
  fourteen/a/p /div

  Any ideas?

  Thanks again.

  On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
   You could also do this with a regular expression. Maybe something like
   this:

   var mystring = $('#title a:first').html(); var firstword =
   mystring.replace(/(^\w+)/,'strong$1/strong');
   $('#title a:first').html(firstword);

   --Karl
   _
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

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.htmlOne Two Three/a /div

INTO THIS:

div id=title
a href=123.htmlstrongOne/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.



[jQuery] Re: How to make the first word bold.

2007-11-12 Thread [EMAIL PROTECTED]

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.htmlOne Two Three/a
 /div

 INTO THIS:

 div id=title
 a href=123.htmlstrongOne/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.



[jQuery] Re: How to make the first word bold.

2007-11-12 Thread Andy Matthews

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.htmlbOne Two Three/a/b/div
 a href=456.htmlfour five six/a /div
 a href=789.htmlseven 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.htmlOne Two Three/a /div

 INTO THIS:

 div id=title
 a href=123.htmlstrongOne/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.




[jQuery] Re: How to make the first word bold.

2007-11-12 Thread Karl Swedberg
You could also do this with a regular expression. Maybe something  
like this:


var mystring = $('#title a:first').html();
var firstword = mystring.replace(/(^\w+)/,'strong$1/strong');
$('#title a:first').html(firstword);


--Karl
_
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:



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.htmlOne Two Three/a
/div

INTO THIS:

div id=title
a href=123.htmlstrongOne/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.






[jQuery] Re: How to make the first word bold.

2007-11-12 Thread Andy Matthews

Viktor...

You'd probably need an $.each() on there then.

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


Thank you all for your help.

Andy, I'm looking to bold the first WORD, of all the links, not the first
link.

Karl, I made a simple page to test your code. It looks like this:

script type=text/javascript src=./src/jquery-1.2.1.pack.js/
script
script type=text/javascript
$(document).ready(function() {
var mystring = $('#links a').html();
var firstword =
mystring.replace(/(^\w+)/,'strong$1/strong');
$('#links a').html(firstword);
});
/script

/head
body

div id=links
p class=titlea href=a.htmlone two three four five/a/p
p class=titlea href=b.htmlsix seven eight/a/p
p class=titlea href=c.htmlnine ten eleven/a/p
p class=titlea href=d.htmltwelve thirteen fourteen/a/p
/div

This results in changing the content to = the first link's content, like so:

div id=links
p class=titlea href=a.htmlstrongOne/strong two three
four five/a/p
p class=titlea href=b.htmlstrongOne/strong two three
four five/a/p
p class=titlea href=c.htmlstrongOne/strong two three
four five/a/p
p class=titlea href=d.htmlstrongOne/strong two three
four five/a/p /div

I'm looking to just make the first word of the link bold (without changing
the content), like this:

div id=links
p class=titlea href=a.htmlstrongOne/strong two three
four five/a/p
p class=titlea href=b.htmlstrongsix/strong seven eight/
a/p
p class=titlea href=c.htmlstrongnine/strong ten elevan/
a/p
p class=titlea href=d.htmlstrongtwelve/strong thirteen
fourteen/a/p /div

Any ideas?

Thanks again.


On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
 You could also do this with a regular expression. Maybe something like 
 this:

 var mystring = $('#title a:first').html(); var firstword = 
 mystring.replace(/(^\w+)/,'strong$1/strong');
 $('#title a:first').html(firstword);

 --Karl
 _
 Karl Swedbergwww.englishrules.comwww.learningjquery.com

 On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:



  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.htmlOne Two Three/a /div

  INTO THIS:

  div id=title
  a href=123.htmlstrongOne/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.




[jQuery] Re: How to make the first word bold.

2007-11-12 Thread Wizzud

eg.

$('#links a').each(function(){
var me = $(this);
me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
  });

or

$('#links a').each(function(){
var me = $(this)
   , t = me.text().split(' ');
me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
  });

etc

On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:
 Viktor...

 You'd probably need an $.each() on there then.

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of Viktor Tarm
 Sent: Monday, November 12, 2007 2:35 PM
 To: jQuery (English)
 Subject: [jQuery] Re: How to make the first word bold.

 Thank you all for your help.

 Andy, I'm looking to bold the first WORD, of all the links, not the first
 link.

 Karl, I made a simple page to test your code. It looks like this:

 script type=text/javascript src=./src/jquery-1.2.1.pack.js/
 script
 script type=text/javascript
 $(document).ready(function() {
 var mystring = $('#links a').html();
 var firstword =
 mystring.replace(/(^\w+)/,'strong$1/strong');
 $('#links a').html(firstword);
 });
 /script

 /head
 body

 div id=links
 p class=titlea href=a.htmlone two three four five/a/p
 p class=titlea href=b.htmlsix seven eight/a/p
 p class=titlea href=c.htmlnine ten eleven/a/p
 p class=titlea href=d.htmltwelve thirteen fourteen/a/p
 /div

 This results in changing the content to = the first link's content, like so:

 div id=links
 p class=titlea href=a.htmlstrongOne/strong two three
 four five/a/p
 p class=titlea href=b.htmlstrongOne/strong two three
 four five/a/p
 p class=titlea href=c.htmlstrongOne/strong two three
 four five/a/p
 p class=titlea href=d.htmlstrongOne/strong two three
 four five/a/p /div

 I'm looking to just make the first word of the link bold (without changing
 the content), like this:

 div id=links
 p class=titlea href=a.htmlstrongOne/strong two three
 four five/a/p
 p class=titlea href=b.htmlstrongsix/strong seven eight/
 a/p
 p class=titlea href=c.htmlstrongnine/strong ten elevan/
 a/p
 p class=titlea href=d.htmlstrongtwelve/strong thirteen
 fourteen/a/p /div

 Any ideas?

 Thanks again.

 On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
  You could also do this with a regular expression. Maybe something like
  this:

  var mystring = $('#title a:first').html(); var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#title a:first').html(firstword);

  --Karl
  _
  Karl Swedbergwww.englishrules.comwww.learningjquery.com

  On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

   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.htmlOne Two Three/a /div

   INTO THIS:

   div id=title
   a href=123.htmlstrongOne/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.