jquery adding data to a div dynamically

jquery

Solution

`Class` and `id` attributes mismatch.you have given as class and selecting as `ID`

 $(".sample").append( newHTML );

or change your div to

<div id="sample">  and then  $("#sample").append( newHTML );

Problem

``` <div class="sample"> </div> ``` I would like to add data to the sample div on click. I am able to get the data to this function. verified with alert but it is not appending to the sample div. ``` $("#editsubmit").click(function(){ var val = $('[name=name111]').val(); var newHTML = '<input type="checkbox" name="'+val+'<br>'; $("#sample").append( newHTML ); }); ```

Original source