Monthly Archives : May 2010

Append the text into the p element in a page with jQUERY

Post on May 31st,2010 by Posted in programming languages| Tagged in , | No Comment

This article will show you how to append the text into the <p> element in a page with jQUERY.

1) Like always, you insert this code <script src=”http://code.jquery.com/jquery-latest.js”></script> within the html <head> tags.

2) Then also within the html <head> tags, you insert this code which will append the text into the <p> element in a page.

<script type=”text/javascript”>
function appendText()
{
$(“p”).append(“Yup, whats up!”);
}
</script>

3) Finally within the body tags, enter this line of code

<p>When I see you, I say  </p>

<form>
<input type = “button” value=”Say Hi” onclick=”appendText()”
</input>
</form>
After you have clicked on the button, the result will be : When I see you, I say Yup, whats up!