Check first character of written answer

Dear everyone!

Is there possibility to visual check the first character(s) of written answer?

so far I have this code:

<div class=frontbg><br>

	<div class=backbg>


<div class=wordtype><input type="text" id="IdWordtypeClass" onkeyup="countChars(this);">{{type:Front}}</div>

<textarea id="IdTextarea" onkeyup="countChars(this);"></textarea>

<p id="charNum">vysledek</p>
<p id="1.znak">1.znak</p>
<p id="1.znak_odpovedi">1.znak odpovedi</p>


function countChars(obj){

	var getIdWordtypeClass = document.getElementById("IdWordtypeClass");

	document.getElementById("IdTextarea").innerHTML = getIdWordtypeClass.value;

	var getTextArea = document.getElementById("IdTextarea");

	document.getElementById("1.znak").innerHTML ="{{Front}}".charAt(0);
	document.getElementById("1.znak_odpovedi").innerHTML = getTextArea.value[0];

	if("{{Front}}".charAt(0) == getTextArea.value[0]) 
			document.getElementById("charNum").innerHTML = 'correct';
			document.getElementById("charNum").innerHTML = 'incorrect';

The problem is that I can use only textarea to check it, and then I have to copy the same text to {{type:Front}} section and thats quite annoying…

Is there any way? :slight_smile:

Youtube link to presentation of the purpose

No one? :scream:

You can use Anki WebView Inspector to inspect what HTML is generated by {{type:Front}}. That way you can try to add your functionality on top.


thank you for your tip! :star_struck: :+1:

this is my final result: youtube link