I had a teacher ask me if they could change the length of a short answer question, I had a look at the documentation and couldn't see any way to so I tried testing it out and looked at the page source and found that there was a maxLength attribute on the input field.
I was able to change the maxLength with this script tag added in the question.
<script type="text/javascript">// <![CDATA[
window.onload = function(){
document.getElementById("id_answer").maxLength = 3;
}
// ]]></script>
After providing this answer to the teacher I found out they actually wanted to increase the length of the question so we ended up using a different script.
<script type="text/javascript">// <![CDATA[
window.onload = function(){
var element = document.getElementById( "id_answer" );
var parent = element.parentNode;
parent.removeChild( element );
parent.innerHTML = '<textarea name="answer" id="id_answer" maxlength="400" cols=50 rows=5></textarea>';
element = null;
}
// ]]></script>
This has worked but I was interested in finding out if there is a different or better way of doing this?