Created
November 27, 2010 16:02
-
-
Save torazuka/718014 to your computer and use it in GitHub Desktop.
html値、text値の挿入とクリックイベント
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>html値、text値の挿入とクリックイベント</title> | |
<script type="text/javascript" src="../scripts/jquery.js"></script> | |
<script> | |
$(document).ready(function() { | |
$("button#q1").click(function() { | |
$("p#e1").text("大丈夫だ。問題ない。"); | |
$("div#q").html("\<button\ type\=\"button\"\ id\=\"q2\"\>そんな装備で大丈夫か??\<\/button\>"); | |
$("button#q2").click(function() { | |
$("p#e2").text("一番いいのを頼む。"); | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>html値、text値の挿入とクリックイベント</h1> | |
<h2>クリックイベントの生成</h2> | |
<button type="button" id="q1">そんな装備で大丈夫か?</button> | |
<p id="e1"></p> | |
<div id="q"></div> | |
<p id="e2"></p> | |
<h2>メモ</h2> | |
<p>ボタンを押すと、文字列とボタン、ボタンのクリックイベントを生成する。</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment