tags:

views:

50

answers:

2

<blockquote><p>We prefer questions that can be answered, not just discussed. Provide details. Write clearly and simply.If your question is about this website, ask it on meta instead.</p></blockquote>.

I want to change above code to this.

    <blockquote>
    <div class="quote_start"><div></div></div><div class="quote_end"><div></div></div>
    <p>We prefer questions that can be answered, not just discussed.
Provide details. Write clearly and simply.If your question is about this website, ask it on meta instead.</p>
    </blockquote>
+3  A: 

Use the prepend method

$('blockquote').prepend('<div class="quote_start"><div></div></div><div class="quote_end"><div></div></div>');

That will place the text as the first child element of the selected object

RHicke
+1  A: 

is this the only blockquote? if so you could use prepend/

$("blockquote").prepend("<div class='quote_start'><div></div></div><div class='quote_end'><div></div></div>");

Otherwise you would need to find someway to identify the blockquote in question before doing the prepend.

Pharabus
i need every blockquote on a page to change this
metal-gear-solid
then my example should work, jquery will apply it to every blockquote it finds. The only problem is if you need to hit specific blockquotes
Pharabus
@pharaus - @RHicke is using double quotes and you are single. why so?
metal-gear-solid
You need to define different quotes for the full string and the strings in the html you are adding (the class name in this example) it does not actually matter which way you do it as long as they are different. I have a preference for double quotes around the whole string but it is purely a personal thing.
Pharabus