Hi, I'm trying to validate if a 'Statement' in the Matrix table question exists using jquery. So the 'Statement' is a span element. I added this 'span' element using the 'html' editor in the matrix table question. Here is the html for the 'Statement' -- ASM)
And here is my js code inside onready function,
if ($('#asm').length) {
alert("The element you're testing is present.");
alert($('#asm').text());
}
But I'm getting this error ---> Uncaught TypeError: Cannot read property 'length' of null. And I inspected the page and confirmed that the 'asm' id element exists so not sure why it is throwing a null.
And I tried this same code outside of Qualtrics using a html and it works perfectly fine. Just strange. Not sure what am i missing. Any help appreciated.
Best answer by Username_taken
View original