I have a class named "field answer" which has an attribute "maxlength" of 250. I want to change this to 9999 for each occurrence of this maxlength attribute.
<div class="field answer">
<textarea name="ctl00$Main$ctrl_16161" rows="2" cols="20" id="ctl00_Main_ctrl_16161" class="long"
onkeyup="return cw.Utilities.trimLength(this)" maxlength="250" style="resize: none; height: 61px;
overflow-y: hidden;"></textarea>
</div>
I am a total noob when it comes to this so please understand. I've tried the following but no luck.
var fieldAnswer = document.getElementsByClassName("field answer");
if (fieldAnswer.namedItem = "maxlength") {
fieldAnswer.maxlength = 9999;
The only thing that seems to work is when I call each tag individually like the following:
$(function() {
$("#ctl00_Main_ctrl_16161").attr("maxlength",9999);});
question from:
https://stackoverflow.com/questions/65905244/how-to-change-maxlength-attributes-for-all-classes-of-field-answer 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…