0

I'm trying to add a new div and input within JQuery, when i use the following code in Firefox it works

jQuery("bracket div closebracket", { "class": "wrapper", id: "product" + i, "onmouseover": "javascript:Highlight('product" + i + "');", "onmouseout": "javascript:Lowlight('product" + i + "');" }) .append(jQuery("", { type: "text", id: "name" + i })) .append(jQuery("", { type: "text", id: "property" + i })) .appendTo("#someContainer");

I can see the onmouseover and onmouseout within Firebug, when looking at IE and Chrome the mouse actions aren't there, does anyone know why they don't work and how i'll be able to get that working.

Thanks in advance

Rav
  • 703
  • 4
  • 13

1 Answers1

0

Not familiar with the syntax you are using to construct new elements. Try something like this instead:

$('<div></div>').addClass('foo').onclick(myFunction).appendTo(myContainer);
jbabey
  • 45,965
  • 12
  • 71
  • 94
  • Hi, that doesn't work. I'm was using the following example http://stackoverflow.com/questions/3416227/create-dynamic-div-with-unique-ids-jquery – Rav Oct 24 '11 at 10:32
  • i've used the following, 'code'jQuery("
    ").appendTo("#someContainer");'code'
    – Rav Oct 24 '11 at 10:45