Skip to content

Instantly share code, notes, and snippets.

@memememomo
Created May 19, 2010 23:39
Show Gist options
  • Save memememomo/407001 to your computer and use it in GitHub Desktop.
Save memememomo/407001 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var pfirst = $("p#first").html();
alert(pfirst);
$("p#first").prepend("<strong>要素内先頭</strong>");
$("p#first").append("<strong>要素内最後</strong>");
pfirst = $("p#first").html();
alert(pfirst);
var wrap = $("div#wrap").html();
alert(wrap);
$("p#first").before("<strong>要素の前</strong>");
$("p#first").after("<strong>要素の後</strong>");
wrap = $("div#wrap").html();
alert(wrap);
});
</script>
<body>
<div id="wrap">
<p id="first">変更前</p>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment