I have a textarea that contains the following content:
<textarea id="testContent"> <img src="..." alt="value"> My text.... </textarea>
I am aware that I can use javascript to specifically target and retrieve the alt value of the img element as follows:
<script>
var $textfeldVal = document.getElementById("testContent");
$img = $textfeldVal.getElementsByTagName("img")[0];
alert("ALT VALUE: "+$img.alt);
</script>
My question is, is there a way to use javascript to select both the alt value of the img tag and the text within the textarea?