Having multiple classes on textarea or button doesn't work
See original GitHub issueThere’s a problem with having multiple classes on the textarea
or button
.
Easy to reproduce in the sample index.html
by adding a class (“other” in example) to the textarea
:
<textarea rows="5" class="other text-to-copy-0">Create as many elements as you want, and match them up by name.</textarea>
<p>
<button class="js-copy-btn-0">Copy text</button>
</p>
This will result in the following error:
Uncaught Error: You don't have a <button> with the class: 'js-copy-btn'. Please check the cheval README.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
add different texts to textarea by button - not working
First, in your html, you need to call your event onclick. Second, you forgot to close the ) like this:
Read more >The Textarea element - HTML: HyperText Markup Language
This attribute enables you to place <textarea> elements anywhere within a document, not just as descendants of form elements.
Read more >Input group - Bootstrap
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs....
Read more >How To Modify Attributes, Classes, and Styles in the DOM
In the code below, there are two div elements with a common class ... will return HTML collections which do not have access...
Read more >How to change the Content of a textarea using JavaScript
Method 2: This method uses the id attribute of the textarea with innerHTML property to change the content of <textarea> element.
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 Free
Top 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
@ryanpcmcquen yepp seems to be working just fine (tested it in my own project aswell).
Great job, dude!
A slightly more elegant solution than mine 😉
My js-skills are very limited so I had to improvise ;D But I look forward to an updated version so I can throw my hack out the window.
No worries, thanks!