I have a object with name value. Is it possible to bind that value to html element? - like angularjs
if so what is the correct way? or is it not possible?
here is my demo :
var ob = {};
ob.name = "Testing";
$('div').text(ob.name);
$('button').on('click', function(){
ob.name = "Update Name";
console.log( ob.name ) //name updates
})
button{
border:1px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<h1></h1> <!-- on click nothing updates automatically -->
</div>
<button>Click Here</button>