Add a new Function `useElement`
See original GitHub issueClear and concise description of the problem
useElement
should able to get an element ref by CSS selector
Suggested solution
useage:
const { element } = useElement('#test')
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
javascript - Attaching functions on an instance of an element
Where 'element' is the element you want to add the property to, 'doSomething' is the name and the third argument is an object...
Read more >Build your own function - Learn web development | MDN
Start by accessing the function-start.html file and making a local copy. · Next, add the following inside the <script> element: function ...
Read more >How to add a new element to HTML DOM in JavaScript
Step 1 − To insert an element into HTML DOM, firstly, we need to create an element and append to HTML DOM. The...
Read more >The document.createElement Function in JavaScript
The createElement() function in JavaScript is used to programatically add elements to the DOM. It has one required argument, the type of ...
Read more >JavaScript Function Objects - Dofactory
When you assign a function object to another variable JavaScript does not create a new copy of the function. Instead it makes the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why not use querySelector, if you use like this : useElement(‘#test’)
I’m not sure that selecting element from other component is vue way. It might create some problems. I might be wrong.