Single Choice Easy

QWhat would the following JavaScript code produce?

function validate() 
{  
    var msg;  
    if(document.myForm.userPass.value.length>5)
    {  
        msg="good";  
    }  
    else
    {  
         msg="poor";  
    }  
    document.getElementById('mylocation').innerText=msg;  
}  
<form name="myForm">  
<input type="password" value="rhuld"  onkeyup="validate()">  
Strength:<span id="mylocation">no strength</span>  
</form>

ID: #5085 Javascript DOM & Event Handling MCQ 139 views
Question Info
#5085Q ID
EasyDifficulty
Javascript DOM & Event Handling MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Strength: good
  • B Strength: poor
  • C Strength: no strength
  • D Undefined
Correct Answer

Explanation

Dynamic text can be written on an HTML document using the innerText property. It is primarily used in web sites to create dynamic content, such as producing the validation message or determining the security of a password.

Share This Question

Challenge a friend or share with your study group.