Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace jQuery code with plan Javascript #1

Closed
grappler opened this issue Dec 23, 2021 · 0 comments
Closed

Replace jQuery code with plan Javascript #1

grappler opened this issue Dec 23, 2021 · 0 comments

Comments

@grappler
Copy link

I noticed that you are using jQuery for these two lines of code.

$(`.wsd-afb-action-input#afb-${prevState.adding} input[type="text"]`).trigger('focus');

$(`.wsd-afb-action-input#afb-${normalizedKey} input[type="text"]`).trigger('focus');

Have you thought about just using plain JS instead? I think you should be able to achieve the same result with the following code and be able to remove the jQuery dependency.

document.querySelector(`.wsd-afb-action-input#afb-${prevState.adding} input[type="text"]`).focus();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants