0

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 Answer 1

3

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');
Sign up to request clarification or add additional context in comments.

2 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.