Accessing dom element outside VueJS Component – querySelector or Jquery

  

Outside component: 
  <input id="mytest" type="text" value="test"  >


In the Vuejs component querySelector or Jquery 
console.log("mytest: "+ document.querySelector("#mytest").value);
console.log("mytest 2: "+ $("#mytest").val());


  

querySelector Browser compatibility
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »