回答編集履歴
4
読みやすく修正。
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
```JavaScript
|
26
26
|
|
27
|
-
var count = 0, interval;
|
27
|
+
var count = 0, interval, $span = $( 'span' );
|
28
28
|
|
29
29
|
$( '#startBtn' ).click( function() {
|
30
30
|
|
@@ -40,6 +40,8 @@
|
|
40
40
|
|
41
41
|
count++;
|
42
42
|
|
43
|
+
$span.text( count );
|
44
|
+
|
43
45
|
console.log( count );
|
44
46
|
|
45
47
|
}, 1000 );
|
@@ -48,7 +50,7 @@
|
|
48
50
|
|
49
51
|
} );
|
50
52
|
|
51
|
-
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/
|
53
|
+
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/5/](https://jsfiddle.net/1a7tux69/5/)
|
52
54
|
|
53
55
|
|
54
56
|
|
3
ミスがあったため修正。
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
$( '#startBtn' ).click( function() {
|
30
30
|
|
31
|
-
if ( int
|
31
|
+
if ( interval ) {
|
32
32
|
|
33
33
|
window.clearInterval( interval );
|
34
34
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
} );
|
50
50
|
|
51
|
-
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/
|
51
|
+
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/4/](https://jsfiddle.net/1a7tux69/4/)
|
52
52
|
|
53
53
|
|
54
54
|
|
2
ミスがあったため修正。
test
CHANGED
@@ -30,13 +30,13 @@
|
|
30
30
|
|
31
31
|
if ( intarval ) {
|
32
32
|
|
33
|
-
window.clearInterval( int
|
33
|
+
window.clearInterval( interval );
|
34
34
|
|
35
|
-
int
|
35
|
+
interval = null;
|
36
36
|
|
37
37
|
} else {
|
38
38
|
|
39
|
-
int
|
39
|
+
interval = window.setInterval( function() {
|
40
40
|
|
41
41
|
count++;
|
42
42
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
} );
|
50
50
|
|
51
|
-
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/](https://jsfiddle.net/1a7tux69/)
|
51
|
+
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/3/](https://jsfiddle.net/1a7tux69/3/)
|
52
52
|
|
53
53
|
|
54
54
|
|
1
補足の追加。
test
CHANGED
@@ -49,3 +49,29 @@
|
|
49
49
|
} );
|
50
50
|
|
51
51
|
```**動くサンプル:**[https://jsfiddle.net/1a7tux69/](https://jsfiddle.net/1a7tux69/)
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
---
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
エラーが出ているかはデベロッパーツールで確認できます。
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
【開発者ツールを使おう! カスタマイズするphpファイルを探す-その1 | RYUS blog】
|
64
|
+
|
65
|
+
[http://ryus.co.jp/blog/customize-php-search-1/](http://ryus.co.jp/blog/customize-php-search-1/)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
【Web開発でよく使う、特に使えるChromeデベロッパー・ツールの機能 - Build Insider】
|
70
|
+
|
71
|
+
[http://www.buildinsider.net/web/chromedevtools/01](http://www.buildinsider.net/web/chromedevtools/01)
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
【Chrome デベロッパーツールの使い方概要 | Web Tips】
|
76
|
+
|
77
|
+
[http://weback.net/utility/1410/](http://weback.net/utility/1410/)
|