views:

25

answers:

1

I want to know is it possible to insert additional text in HTML elements using jquery or javascript?

If there is already a text "Down" in paragraph elements, then I just want to append text "full", so that it would be "Down full". Is this possible? Which method should I use?

+1  A: 

With jQuery, have a look at .append():

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

E.g.:

$('p').append(' full');
Felix Kling
Thanks! what if I would like to append every passed text to a new line rather than in sequence?
Alvin
@Alvin: I am not sure what you exactly mean, but a line break in HTML is `<br />` so: `$('p').append('<br />full')`
Felix Kling