I refactored your function to use jQuery:
function appLayer(id){
  //create layerbox
  this.$layer = $("<div id='" + id + "_layer'
class='layerbox'></div>").appendTo("#content");

  //create form
  this.$layer.append(this.$form = $("<form id='" + id + "_form' name='" +
id + "_form' action='index.php' method='post'></form>"));

  //create main div
  this.$main = $("<div id='" + id + "_main'
class='morebox'></div>").html("This box should get created, but it doesnt
because form didnt get created").prependTo(this.$form);
}

Interestingly, when I tryed to use this.$form.appendTo(this.$layer) it
didn't work. Is this a bug? Not sure. But this function worked for me.

Blair

On 1/25/07, Jeremy Dill <[EMAIL PROTECTED]> wrote:

 After upgrading from 1.0.4 to 1.1.1 the following code no longer works.
Please tell me if there is a solution to this issue.

-------------------------------WORKING HTML TEST PAGE------------
<html xmlns="http://www.w3.org/1999/xhtml";><http://www.w3.org/1999/xhtml%22%3E>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<style>
.layerbox{font-size:8pt;text-align:left;padding:10px;margin:20px;border:1px
solid #B2C5EC; background-color:#FCFCFC;float:left;
clear:left;height:200px;width:200px}
</style>
<script type='text/javascript' src='/js/jquery111.js'></script>
</head>

<body>
<div id='content'></div>
<script language="JavaScript">
function appLayer(id){
 //create layerbox
  var layerbox=document.createElement('div');
  layerbox.id=id+"_layer";
  layerbox.className="layerbox";
  $("#content").prepend(layerbox);
  this.divName=layerbox.id;
  this.layerobj=layerbox;
 //create form
  var frm=document.createElement('form');
  frm.id=id+"_form";
  frm.name=id+"_form";
  frm.action = "index.php";
  frm.method = "post";
   this.frm=frm.id;
//-------HERE IS THE PROBLEM-----///
  $("#"+this.divName).append(frm);
//-------APPEND DOESNT WORK FOR FORM OBJECT------///
  //create main div
 var main=document.createElement('div');
 main.id=id+"_main";
 main.className="morebox";
 main.innerHTML="This box should get created, but it doesnt because form
didnt get created";
 $("#"+this.frm).prepend(main);
}
tst=new appLayer('Test');
</script>
</body>
</html>
----------------------------END PAGE-----------------

The form object does not get created.  I don't have any problems appending
other objects such as divs, but the form object won't work anymore.

It works fine in 1.0.4.  Try it out.

Thanks in advance.

Jeremy

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to