01.
<!DOCTYPE html>
02.
<
html
>
03.
<
head
>
04.
<
meta
content
=
"width=device-width initial-scale=1.0 minimum-scale=1.0 maximum-scale=1.0 user-scalable=no"
name
=
"viewport"
>
05.
<
meta
charset
=
"UTF-8"
>
06.
<
link
rel
=
"stylesheet"
href
=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css"
>
07.
08.
<
script
src
=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></
script
>
09.
10.
<
script
>
11.
// jQuery のロードイベント( コントロールが全てページ上に作成されてから実行されます )
12.
$(function(){
13.
14.
// alert("ページがロードされました");
15.
16.
$("#btn").on("click", function(){
17.
18.
var gakusei = $("#simei").val();
19.
20.
alert(gakusei);
21.
22.
});
23.
24.
});
25.
</
script
>
26.
27.
</
head
>
28.
<
body
>
29.
<
h1
>jQuery のこんにちは世界</
h1
>
30.
31.
<
input
type
=
"text"
id
=
"gakusei"
value
=
"123456"
>
32.
33.
<
input
type
=
"text"
id
=
"simei"
value
=
"山田 太郎"
>
34.
35.
<
input
type
=
"button"
id
=
"btn"
value
=
"実行"
>
36.
37.
38.
</
body
>
39.
</
html
>