javascript - Can node js calculate the value of two input fields and update another field? -
I would like to calculate the value of two input field values using nodejs and update one answer field
& lt; Input type = "text" name = "number" & gt; & Lt; Input type = "text" name = "number" & gt; & Lt; Input type = "text" name = "answer" & gt; I did it with jquery and wondering if it would be possible with nodes?
The original answer is not, not on itself.
node. JS runs on the server side of things. An example, like your example, runs on the customer (browser). You still need to run some other client-side javascript so that at least fields can be sent back to the node server app.
You can instead see that the system client like angiarajs will provide a little more structure.
Here is javascript:
var app = angular.module ('plunker', []); App.controller ('MainCtrl', function ($ scope) {$ scope.value1 = 'hello'; $ scope.value2 = 'world'; $ radius. $ Watch ('value1', updateValue3); $ scope. $ Watch ('Value2', updateValue3); Function Update Value 3 () {$ scope.value3 = $ scope.value1 + '"$ scope.value2;}}); Here's HTML:
& lt; Head & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Title & gt; Finger Jess Plunker & lt; / Title & gt; & Lt; Script & gt; Document.written ('& lt; base href =' '+ document.location +' "/>); & Lt; script data - rp =" angular.js@1.3.x "src =" https://code.angularjs.org/1.3.10/angular.js "data-saver =" 1.3 " 10 "& gt; & lt; / script> & gt; script src =" app.js "& gt; & lt; / script & gt; & lt; / head & gt; & lt; body ng-controller = "MainCtrl"> Labels = "" & gt; Value1
label = "" & gt; & lt; label = "" & gt; ; Value 3 & lt; input ng-model = "value3" & gt; & lt; / l Force> You do not need input to show the value either: {{value3}}
Comments
Post a Comment