-2

I am using some JavaScript within an angular project (I am not familiar with angular.js, hence Js). I have a text input field in my form with a placeholder by default. I want to insert some actual text into the field depending on user action.

HTML:

<input type="text" id="logon" name="logon" ng-model="user.logon" placeholder= "Username" required>

When I run

var x = document.getElementById("logon");
x.value = "a";

nothing happens. Yet, when I use

var x = document.getElementById("logon");
x.placeholder = "b";

the place-holder text is changed, This would surely indicate that the code is running at the correct time, just that I'm missing something in the x.value code line?

myol
  • 8,857
  • 19
  • 82
  • 143

1 Answers1

1

It is looking like angularJS . SO you can do it by ng-model

$scope.user.logon = "a";
Ashisha Nautiyal
  • 1,389
  • 2
  • 19
  • 39
  • Thankyou! This is what is was. Thanks for helping me with my clear lack of knowledge of angularjs. – myol Aug 05 '14 at 11:43