In Jquery how to refer javascript's element created by document.createElement -
i have code written in javascript:
var objto = document.getelementbyid('krishna') var href1 = document.createelement("div"); href1.setattribute("style","float: left"); objto.appendchild(href1);
already many elements appended href1 in javascript.
i want add more elements href1 using jquery
i tried href1.append("<br>");
it says href1.append not function
how use jquery append append element href1.
you need turn native element jquery object. native elements don't recognize jquery methods
try
$(href1).append("<br>");
if want jquery alone code quite simple
// create new <div> element , apply style var href1 = $("<div>").css('float','left'); // append id=krishna $('#krishna').append(href1);
Comments
Post a Comment