Menu
×
×
Correct!
Exercise:Refs are used to refer to specific DOM elements. Supply the missing code so that 'Hello World' is displayed in the second <p> tag when the application is mounted.
<template>
<p>This is just some text.</p>
<p ref="pEl">This is the initial text</p>
</template>
<script>
export default {
mounted() {
this.$refs.pEl.innerHTML = "Hello World!";
}
};
</script>
<template>
<p>This is just some text.</p>
<p ref='pEl'>This is the initial text</p>
</template>
<script>
export default {
mounted() {
this.$refs.pEl.innerHTML = "Hello World!";
}
};
</script>
Not CorrectClick here to try again. Correct!Next ❯<template> <p>This is just some text.</p> <p>This is the initial text</p> </template> <script> export default { mounted() { this. .pEl.innerHTML = "Hello World!"; } }; </script> |