Why I can't get the updated text from two textarea
elements that have the same class and default text?
For example, if I try to add new text to any of these textarea
elements then hit the button I get only the old values.
This is my code:
HTML
<div class="tag-container">
<textarea class="variables">s:asset:type, s:event:type, l:event:playhead, s:asset:video_id, s:asset:ad_id, s:user:mid</textarea>
<button class="remove-tag">Remove</button>
<hr/>
</div>
<div class="tag-container">
<textarea class="variables">name, mid, pev3</textarea>
<button class="remove-tag">Remove</button>
<hr/>
</div>
<button class="validate">Validate</button>
JS:
$(document).on('click', '.validate', function() {
var variables = "";
$('.variables').each(function(){
variables += $(this).text() + ",";
});
console.log(variables);
});