Ad

Uncaught Error NOT_FOUND_ERR DOM Exception 8

- 1 answer

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.

Ad

Answer

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

should be

divMessage.style.color="rgb(105,105,105)";
Ad
source: stackoverflow.com
Ad