回答編集履歴

2

参照先

2017/06/10 03:50

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- text()はHTMLエスケープしますのでhtml()を使うと良いです。
5
+ text()はタグをエスケープしますのでhtml()を使うと良いです。
6
+
7
+ 参考:[.htmlと.textと.valで混乱したので整理する](http://qiita.com/munaita_/items/1940329bb95f47eaa2ee)
8
+
9
+
6
10
 
7
11
  ```javascript
8
12
 

1

勘違い・・

2017/06/10 03:50

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -1,22 +1,24 @@
1
- span入れればいいんですよね?
1
+ ※質問を勘違いしてましたで全体的書き直しました。
2
2
 
3
+
4
+
3
- これうでしょう
5
+ text()はHTMLエスケープしますのhtml()を使と良い
4
6
 
5
7
  ```javascript
6
8
 
7
- price = 0;
9
+ price_option = '<span class="price_small">円</span>';
8
10
 
9
- if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) {
10
11
 
11
- price = classcat2.price02;
12
12
 
13
- } else {
13
+ if (classcat2 && typeof classcat2.price02 !== 'undefined' && String(classcat2.price02).length >= 1) {
14
14
 
15
- price = this.proce02_origin;
15
+ $price02.html(classcat2.price02 + price_option);
16
16
 
17
- }
17
+ } else {
18
18
 
19
- $price02.text( '<span class="price_small">'+price +'円</span>');
19
+ $price02.html(this.proce02_origin + price_option);
20
+
21
+ }
20
22
 
21
23
 
22
24