Skip to content

Commit 28839a7

Browse files
committed
feat: name attribute and variable renamed to key
1 parent d759207 commit 28839a7

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

demo/index.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ <h6 style="color: blue">4 example RADIOBUTTON</h6>
8080
<label class="option">
8181
<input
8282
type="radio"
83-
name="pack"
83+
key="pack"
8484
value=""
8585
show="#ctr_personal1" />
8686
<span class="radio"></span> Personal
8787
</label>
8888
<label class="option">
8989
<input
9090
type="radio"
91-
name="pack"
91+
key="pack"
9292
value=""
9393
show="#ctr_business1"
9494
checked />
@@ -97,7 +97,7 @@ <h6 style="color: blue">4 example RADIOBUTTON</h6>
9797
<label class="option">
9898
<input
9999
type="radio"
100-
name="pack"
100+
key="pack"
101101
value=""
102102
show="#ctr_corporate1" />
103103
<span class="radio"></span> Corporate
@@ -116,15 +116,15 @@ <h6 style="color: blue">5 example RADIOBUTTON (show MULTIPLE)</h6>
116116
<label class="option">
117117
<input
118118
type="radio"
119-
name="package"
119+
key="package"
120120
value=""
121121
show="#ctr_personal" />
122122
<span class="radio"></span> Personal
123123
</label>
124124
<label class="option">
125125
<input
126126
type="radio"
127-
name="package"
127+
key="package"
128128
value=""
129129
show="#ctr_business,#other_business"
130130
checked />
@@ -133,7 +133,7 @@ <h6 style="color: blue">5 example RADIOBUTTON (show MULTIPLE)</h6>
133133
<label class="option">
134134
<input
135135
type="radio"
136-
name="package"
136+
key="package"
137137
value=""
138138
show=".ctr_corporate" />
139139
<span class="radio"></span> Corporate

docs/index.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
sizes="32x32"
1212
href="https://cocreate.app/images/favicon.ico" />
1313
<meta
14-
name="description"
14+
key="description"
1515
content="Simple JS component show &amp; hide elements conditionally with inputs,checkbox,radio,btn etc.Great for creating tabs, accordions, dynamic forms, etc" />
1616
<meta
17-
name="keywords"
17+
key="keywords"
1818
content="helper classes, utility classes, css framework, css library, inline style classes" />
1919
<meta name="robots" content="index,follow" />
2020
<meta
@@ -31,7 +31,7 @@
3131
href="/docs/index.css"
3232
array="files"
3333
object="60888216117c640e7596303f"
34-
name="src"
34+
key="src"
3535
type="text/css"
3636
save="true" />
3737
<link rel="manifest" href="/manifest.webmanifest" />
@@ -46,7 +46,7 @@
4646
scroll-down="10"
4747
array="files"
4848
object="60395ef42b3ac232657040fd"
49-
name="src"></nav>
49+
key="src"></nav>
5050
<sidenav
5151
id="menuL"
5252
class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
@@ -57,7 +57,7 @@
5757
<menu
5858
array="files"
5959
object="603717b07de7fb350ae9fec8"
60-
name="src"></menu>
60+
key="src"></menu>
6161
<div resize="right"></div>
6262
</sidenav>
6363
<main
@@ -293,7 +293,7 @@ <h2 class="padding:5px_0px">Demo</h2>
293293
lang="html"
294294
array="demos"
295295
object=""
296-
name="demo"
296+
key="demo"
297297
save="false"
298298
id="demo"
299299
class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ function clickShowHideEle(e) {
6868
let tagName = element.tagName.toLowerCase();
6969

7070
if (tagName == 'input' && element.getAttribute("type").toLowerCase() == 'radio') {
71-
let name = element.getAttribute("name");
72-
let radios = document.querySelectorAll(tagName + '[name="' + name + '"]');
71+
let key = element.getAttribute("key");
72+
let radios = document.querySelectorAll(tagName + '[key="' + key + '"]');
7373
for (let radio of radios) {
7474

7575
show = radio.getAttribute('show');

0 commit comments

Comments
 (0)