Access text of another element and pass it to some function #4465
-
How can I get the text of another element and use it by passing to a function in current element?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
you don't need to use refs to access internal data <span @click= "someFunction(item)">
<span x-text="item"></span>
</span> in general $refs.text (without single quotes), return the html element so you need the browser api to get the text content from there (textContent or innerText) |
Beta Was this translation helpful? Give feedback.
-
I did try but I was using a global function, not a function defined in x-data. |
Beta Was this translation helpful? Give feedback.
have you tried?
https://codepen.io/SimoTod/pen/VYZvbQQ