uncaught error NOT_FOUND_ERR DOM Exception 8

user945221 picture user945221 · Sep 29, 2011 · Viewed 16.3k times · Source

So I am deleting all the contents under a particular div and adding a message content. However, javascript throw the following error after the finish:

Uncaught Error: NOT_FOUND_ERR: DOM Exception 8

Here is the code where it is executed

 new Ajax.Request("profileThis.php",
 {
   method:'post',

   parameters:{title:title, review:review, userId:userId, category:category, categoryId:categoryId},

   onSuccess:function(ajax) 
   {
    alert(ajax.responseText); // this is just for debugging purposes

    var message=ajax.responseText;

    var divMessage=document.createElement("div");

    divMessage.style.color="rgb:(105,105,105)";

    divMessage.innerHTML=message;

    while($("reviewSheet").hasChildNodes)
    {
     $("reviewSheet").removeChild($("reviewSheet").lastChild);
    }

    $("reviewSheet").adopt(divMessage);         

   },

   onFailure:ajaxFailure,

   onException:ajaxFailure

 });

People commented that the problem was with how I assigned divMessage to reviewSheet. I tried both adopt and appendChild but none works. A little help would be appreciated.

Answer

epascarello picture epascarello · Sep 29, 2011
divMessage.style.color="rgb:(105,105,105)";

should be

divMessage.style.color="rgb(105,105,105)";