jQuery append method not appending, Why?

From my JSFiddle here, Could anyone please tell me why the div containing id as button isn’t getting appending in the following code ?

var newEl = $("<div/>", {
                    class: "clickable",
                    //id: "grid" + id,
                    style: "margin:100px 10px 20px 20px ",
                }).append($("<div />", { id: "button"})).appendTo(document.body);

All I see in my console log is this (I clicked on first row of grid , then first row of the newly generated grid below it) and could not find another div with button id:

The second parameter is invalid. Cf. http://api.jquery.com/append/

The snippet alone works fine, but it seems that jqxGrid replaces the children of the target element, so the inner div with id="button" is immediately getting removed in your fiddle.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.