The angularJS form is given below this question. what i want to do is change the value of #quantity
input from 1 to 200 using JavaScript and then click on the Buy button. But after i submit the form by clicking on the Buy button, the value of #quantity
input returns to its default value which is 1.
I tried the following code to change the value of
#quantity input
element:
var qty = document.getElementById('quantity');
var buy = document.querySelector('button.btn.place');
qty.value = "123";
qty.select();
buy.click();`
But it doesn't work. It always rejects the value. Sorry, i don't have any knowledge about AngluarJS and also it will take a lot of time for me to learn AngularJS.
Here is the code for the QTY input element:
<input type="number" step="1" id="quantity" name="quantity" ng-model="options.quantity" class="input width-100 numeric ng-isolate-scope ng-valid-number ng-valid-checklotsize ng-dirty ng-valid-required ng-valid ng-valid-integer" min="1" checklotsize="1" integer="" esc-key="" esc-key-action="close()" ng-disabled="!uiConstraints.quantity" required="">
and the BUY button:
<button type="submit" class="btn place btn-blue" ng-class="options.transaction_type == 'BUY' ? 'btn-blue' : 'btn-orange'" ng-disabled="buysellform.$invalid || order_status === true">
<span class="spinner icon ng-hide" ng-show="order_status === true">
<span class="icon icon-spinner animate-spin"></span>
</span>
<span class="icon ng-hide" ng-show="order_status !== true && execution_type == 'MODIFY'">MODIFY</span>
<span class="icon ng-binding" ng-show="order_status !== true && execution_type == 'PLACE'">BUY</span></button>