Skip to content

Commit af00821

Browse files
committed
chore: add null check
1 parent d986328 commit af00821

File tree

1 file changed

+12
-6
lines changed
  • src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister

1 file changed

+12
-6
lines changed

src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister/Template5.razor.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
if (email) {
66
email.classList.add('show');
77
const input = email.querySelector('.input');
8-
input.focus();
9-
input.select();
8+
if (input) {
9+
input.focus();
10+
input.select();
11+
}
1012
}
1113
}
1214
}
@@ -27,8 +29,10 @@ export function go(id) {
2729
password.classList.add('animate-fade-in')
2830
password.classList.remove('animate-fade-out')
2931
const input = password.querySelector('.input');
30-
input.focus();
31-
input.select();
32+
if (input) {
33+
input.focus();
34+
input.select();
35+
}
3236
}
3337
}
3438
}
@@ -42,8 +46,10 @@ export function back(id) {
4246
email.classList.remove('animate-fade-out');
4347
email.classList.add('animate-fade-in');
4448
const input = email.querySelector('.input');
45-
input.focus();
46-
input.select();
49+
if (input) {
50+
input.focus();
51+
input.select();
52+
}
4753
}
4854

4955
const password = el.querySelector('.login-item-password');

0 commit comments

Comments
 (0)