Right. but i need all the "first" paragraph of each "page", to execute an
"each" function for each one :)
Ok. this is what i looking, put in cap each letter of only the first
paragraph of each sign, like a combination of fancy drop caps part 1 and
fancy drop caps part 2
http://www.learningjquery.com/2006/10/fancy-drop-cap-part-1
http://www.learningjquery.com/2006/10/fancy-drop-cap-part-2
$(document).ready(function(){
swap_letter();
});
function swap_letter() {
var parag = $('.firma p:first'); <----- Only get the fisrt
parag.each(function(index) {
var first_paragraph = this;
if (!first_paragraph) return false;
var node = first_paragraph;
while (node.childNodes.length) {
node = node.firstChild;
}
var text = node.nodeValue;
var first_letter = text.substr(0,1);
var match = /[a-zA-Z]/.test(first_letter);
if ( match ) {
node.nodeValue = text.slice(1);
$('<img />')
.attr('src','assets/alphabet/' + first_letter.toLowerCase() + '.gif')
.attr('alt',first_letter)
.addClass('fancy-letter')
.prependTo( first_paragraph );
}
});
}
----- Original Message -----
From: "Joel Birch" <[EMAIL PROTECTED]>
To: <jquery-en@googlegroups.com>
Sent: Tuesday, June 05, 2007 11:40 AM
Subject: [jQuery] Re: Problem getting first paragraph
How about:
var first_paragraphs = $('#book div.page p:first');
Joel.
On 06/06/2007, at 12:34 AM, Sebastián V. Würtz wrote:
How i get the first p of each div page inside the id book?
This not work
$('#book .page').each(function(index) {
var first_paragraph = $(this + " p").eq(0);
<div id="book">
<div class="page">
<h1>xxxxxxx</h1>
<p>cccccccc</p>
<p>dddddd</p>
</div>
<div class="page">
<h1>asdasdas</h1>
<p>cccccccc</p>
<p>tttttttt</p>
</div>
<div class="page">
<h1>2222222</h1>
<p>cccccccc</p>
</div>
</div>
thx
Estoy utilizando la versión gratuita de SPAMfighter para usuarios
privados.
Ha eliminado 2470 correos spam hasta la fecha.
Los abonados no tienen este mensaje en sus correos.
¡Pruebe SPAMfighter gratis ya!
__________ NOD32 2309 (20070605) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
--
Estoy usando la versión gratuita de SPAMfighter para usuarios privados.
Ha eliminado 2470 correos spam hasta la fecha.
Los usuarios de pago no tienen este mensaje en sus correos.
Obtenga SPAMfighter gratis aquí: http://www.spamfighter.com/les