<div>Message: {{ msg }}</div>
<div id='app'> <div>{{ str }}</div> <button @click='str = "Love the Life"'>Click</button> </div> <script> var vm = new Vue({ el: '#app', data: {str: 'Be Yourself.'} }) </script>
v-html
directive.<div id='app'> <p>Using mustaches: {{ str_html }}</p> <p>Using v-html directive: <span v-html="str_html"></span></p> </div> <script> var vm = new Vue({ el: '#app', data: {str_html: '<b style="color:#00f">Be Yourself.</b>'} }) </script>
Mustaches cannot be used inside HTML attributes.
{{ number + 1 }} {{ ok ? 'YES' : 'NO' }} {{ message.split('').reverse().join('') }} <div v-bind:id="'list-' + id"></div>- Example, shows the number of clicks on a button:
<div id='app'> <div>Number of licks: {{ nr}}</div> <button @click='nr +=1'>Click</button> </div> <script> var vm = new Vue({ el: '#app', data: {nr: 0} }) </script>
<div id='app'> <p>{{ msg.split('').reverse().join('') }}</p> Add some text in this input:<br> <input v-model='msg'> </div> <script> var vue_ob = new Vue({ el: '#app', data: {msg: 'Hello Vue!'} }) </script>
<ul> <li>http://coursesweb.net/html/</li> <li>http://coursesweb.net/css/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net