try
script type=text/javascript
$(document).ready(function() {
$('#links a').each(function(){
var mystring = $('this').html();
var firstword = mystring.replace(/(^\w+)/,'strong
$1/strong');
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
...
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
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
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);
});
)
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
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
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
: [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
9 matches
Mail list logo