teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2017/03/18 05:20

投稿

castail
castail

スコア117

title CHANGED
File without changes
body CHANGED
@@ -34,4 +34,7 @@
34
34
  ※ちなみに、一部自動入力部分があります。
35
35
  例:name="name1"に氏(漢字)が入力された場合、name="name3"には氏(カタカナ)が自動入力される等。
36
36
  その際当然name3も自動で「background-color: rgb(255, 255, 255);」に切り替わります。
37
- 質問内容に関係ないかもしれませんが念のため共有いたします。
37
+ 質問内容に関係ないかもしれませんが念のため共有いたします。
38
+
39
+ =追記=
40
+ 今回既存ページの改修のためinlineのstyle属性を外部cssなどに変更したり、html構成を変えるなどの前提条件の変更はできないので上記構成で実現可能な方法でご教授頂ければ有り難いです。

1

編集

2017/03/18 05:20

投稿

castail
castail

スコア117

title CHANGED
File without changes
body CHANGED
@@ -6,8 +6,8 @@
6
6
  <input type="text" name="name2" value="" style="background-color: rgb(255, 255, 255);" class="hoge1 hoge2">
7
7
  <input type="text" name="name3" value="" style="background-color: rgb(255, 221, 221);" class="hoge1">
8
8
  <input type="text" name="name4" value="" style="background-color: rgb(255, 255, 255);" class="hoge1 hoge2">
9
- <label style="background-color: rgb(255, 221, 221);"><input name="check1" type="checkbox" class="hoge1">texttexttext</label>
9
+ <label style="background-color: rgb(255, 221, 221);" class="hoge1"><input name="check1" type="checkbox" >texttexttext</label>
10
- <label style="background-color: rgb(255, 255, 255);"><input name="check2" type="checkbox" class="hoge1 hoge2">texttexttext</label>
10
+ <label style="background-color: rgb(255, 255, 255);" class="hoge1 hoge2"><input name="check2" type="checkbox">texttexttext</label>
11
11
  ```
12
12
  一部必須入力要素において、未入力時style属性に「background-color: rgb(255, 221, 221);」が付与されているのですが、
13
13
  入力、チェック済みの場合動的に「background-color: rgb(255, 255, 255);」へ切り替わります。