Consider following HTML snippet:

<input type="text" value="zombie"/>
<input type="submit" />
What will be the value of attribute "value" after executing following jQuery code snippet?

$('input[type="button"]').click(function(){
        $('input[type="text"]').val('human');
});
Explanation

$('input[type="text"]').val('human');
Will change the 'input[type="text"]' value.

$('input[type="text"]').atrr('value','human');
Will change the value of attribute "value"

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes