Obtener la primera oración HTML

How get first sentence from html with image assuming image will be between p tags. http://jsfiddle.net/TvyS8/

I need image and first sentence.

I'm thinking about regular expression for image and indexOf for finding symbols of sentence ending. Need more opinions, or example how to do it better

I'm getting information via JSON from Tumblr.

preguntado el 01 de septiembre de 12 a las 15:09

So, in your example, you want OPS1 continues to improve on its biggest strength: cloud control made easy. ¿como resultado? -

Not exactly, yes i want this sentence and image above this sentence. -

1 Respuestas

http://jsfiddle.net/HW3rT/ .

EDIT:UPDATED FIDDLE

http://jsfiddle.net/2gPXb/

FIDDLE UPDATED

http://jsfiddle.net/XAtcS/

Violín actualizado http://jsfiddle.net/XAtcS/1/

var element={};
$('p').each(function(){

if($(this).children().eq(0).prop('tagName')=='IMG' && $(this).next().children().eq(0).prop('tagName')!='IMG')
{
element.first=$(this).html()+$(this).next().html();
}
})
document.write(element.first)

Ii will take first p text which does not contain img tag

Respondido el 02 de Septiembre de 12 a las 10:09

I need image and first sentence. - mrancys

Doesn't work... The result should be Image and sentence above image "OPS1 continues to improve on its biggest strength: cloud control made easy." - mrancys

you want image after sentence "OPS1"?? - Ashirvad

I see paragraph, but i want only this sentence and image. "OPS1 continues to improve on its biggest strength: cloud control made easy." - mrancys

Thanks, found my on the track. Thanks again man! And updated fiddle :) jsfiddle.net/XAtcS/2 - mrancys

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.