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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -