html code like this I want to get all the values in each text area from container-body class
lets assume that I have duplicate elements
<div class="container-body">
<div class="p-form">
<ul class="p-formList">
<li class="p-formList__item">
<div class="p-formList__item__body">
<div class="c-input c-input--full">
<textarea type="text" class="body-text" placeholder="説明記入をお願いします"
name="description"
value="">
</textarea>
</div>
</div>
</li>
</ul>
</div>
</div>
My Answer:
You can achieve this by using JavaScript to loop through all the input elements within the container-body class and store their values in an array or object. Here's an example code snippet to demonstrate this:
html
Get Input Values
In this code snippet, we first select all input elements within the container-body class using `document.querySelectorAll('.container-body input')`. Then, we loop through each input element using `forEach` and push its value to the `inputValues` array. Finally, we log the `inputValues` array to the console.
Rate this post
5 of 5 based on 5920 votesComments