views:

31

answers:

1

iam using an empty div in which i am assigning values through an external javascript via ajax call iam also using an fck editor what i want to do using an internal javascript i want to set the contents of that div in the textarea of fckeditor but in the internal javascript when iam accessing the contents of that div then it is showing "undefined"....

+1  A: 

You can use setAttribute method to set 'value' attribute of an attribute.

let take an example:

George Doe: Human resources department

To insert a new DIV directly above "george", so the outcome becomes:

Kevin Lin: Main system administrator `enter code here`George Doe: Human resources department

You would do the following:

var newemployee=document.createElemen`enter code here`t("div") var oldemployee=document.getElementById("george") newemployee.setAttribute("id", "kevin") newemployee.innerHTML="Kevin Lin: Main system administrator" document.getElementById("employees").insertBefore(newemployee, oldemployee)
can you please elaborate
Mac