question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a new Function `useElement`

See original GitHub issue

Clear 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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
1084350607commented, Aug 12, 2022

Why not use querySelector, if you use like this : useElement(‘#test’)

0reactions
chaii3commented, Aug 12, 2022

Why not use querySelector, if you use like this : useElement(‘#test’)

I wanna got a null when element has been removed, a hook will be better.

I’m not sure that selecting element from other component is vue way. It might create some problems. I might be wrong.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found