2016-07-18 9 views
-1

java scriptを使用してHTML要素に新しい段落を追加したいが、無効な追加機能のエラーが発生する。未知の型エラー:e_type.appendchildは関数ではありません。 JavaScript内に要素を追加中

**// Html code :-** 

Image

<button onclick= "add()">Click me to add New text.. </button> 

**// JavaScript code :-** 

function add()  
{  
    var e_type = document.createElement("p"); 
    var text = document.createTextNode("Hello Again..!"); 
    e_type.appendchild(text); // error- e_type.appendchild is not a function  
    var parent_type = document.getElementById("self");   
    parent_type.appendchild(e_type);   
} 

答えて

0

JavaScriptの大文字と小文字が区別されます:それはappendChild(首都C)、ではないappendchildです。

+0

** Thanks @ T.J.クラウダー** –

関連する問題