I'm still new to JavaScript but I wrote a small script that sends messages to a webhook. Which works great, but now I need to set some conditions to it before it may execute. The condition I wanted to set here was that the field "name" has to have a minimal length of 9 characters. I just can't find the fault in this if statement.
function json()
{
if(document.getElementById('name').length >= 9)
{
var msgJson = {
"text": "success",
};
send(msgJson);
}
}
Does anyone have the answer for me?
Thanks in advance!