This article mainly introduces the different methods of inputting content in the input box, which will be displayed in the p below:jsmethod;jQuerymethod;AngularJsmethod has good reference value. Let’s take a look at it with the editor below
An example question: Enter the content in the input box, and the different methods will be displayed in the p below:
js: NativeDOM operation
Guide on the maze:
getElementById getsDOM node, innerHTML: sets or gets all the HTML code inside the node;
You need to pay attention here to get the node in the input The content needs to get the value.
The innerHTML attributesand value attributes are used here. Pay attention to distinguishing them from the methods in JQ
JQ operation:
Guide:
jQuery("selector").action(); through the selector Call theeventfunction, but in JQuery, JQuery can be replaced by $, that is, $("selector").action();
>>Select The selector can directly use theCSS selectorto select the element; In html(), val() are methods here, and in JS they are attributes
AngularJs operation:
请输入内容:
Guidance:1.ng-app: ng-app=""Declares the scope of Angular's jurisdiction, usually written in the body and HTML. In principle, a page can only Can there be a
2.ng-model: put the element value (instruction to put the input domain value) is bound to the application
3.ng-bind: Instruction to bind the application variable name to the innerHTML of a certain paragraph. You can use
##< p>{{name}}
[Related recommendations]
Free js online video tutorial
2.JavaScript Chinese Reference Manual
3.php.cn Dugu Jiujian (3)- JavaScript video tutorial
The above is the detailed content of Enter content in the input box, and three method instances will appear in the corresponding div.. For more information, please follow other related articles on the PHP Chinese website!