Code completion on your own function like document.getElementById
Hi folks,
I'm not using JQuery for a project I'm doing (I have my reasons), and instead only a very simple lightweight framework.
One of the first things you do in this case, however, is to shorten document.getElementById because it's used so much, e.g. :
function $$(elementId){ return document.getElementById(elementId); }
…such that your code ends up looking like this:
$$("someElementBla").style.display = “none”;
PhpStorm (et. al.) will nicely code-complete HTML element IDs in the “real” document.getElementById when you use the function.
In like fashion, the JQuery $ function also does this code-completion.
So my question is, how do I make my function do this?
It seems like my issue would have to be a pretty common one since, if you aren't using JQuery or some other framework, you'd have the same problem.
Thanks for any help you might have…
请先登录再写评论。
Hi Steve,
I hope you would not mind if I share your question with the solution on StackOverflow here:
https://stackoverflow.com/questions/77165534/code-completion-for-html-dom-in-javascript-string-literals-in-intellij-phpstor