[Vuejs]-What am I doing wrong on Vue.js?

3👍

You have to remove the # in <div id="#app">

Here is the full code :

new Vue({
  el:'#app',
  data:
  {
    title:"Hello World!"
  }
});
<!DOCTYPE html>
<html>
  <head>
    <title></title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script>
  </head>
  <body>
    <div id="app">
      <p> {{ title }} </p>
    </div>
    <script src="script.js"></script>
  </body>
</html>
<html>
👤BTL

1👍

# means id, you don’t need to put id="#app", that’s repetitive.

Besides that, you should load vue before you use new Vue.

<html>
<head>
<title></title>
</head>
<body>
<div id="app">
   {{ title }}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script>
<script>
  new Vue({
    el:'#app',
    data() {
      return {
        title: "Hello World"
      }
    }
});
  </script>
</body>
</html>

Leave a comment