I am using Jquery, making table cells that contain multiple divs. the divs contain some data and a radio button. my code works, but i want to know why i had to use a "middle-man" variable. seems really weird to me, was very frustrating, and im curious why. perhaps i just dont undestand this well enough. here is my code
// my radio button
var rad_button = $('<input type="radio"...'
// my object, div w some attributes, text
var my_Object = $('<div class="selected...'
rad_button.prependTo(my_Object);
var middle_man = my_Object;
middle_man.appendTo(bigger_object);
this is the only way i could get this to work. i tried the more direct way:
my_object.appendTo(bigger_object);
but that didnt work. anyone able to tell me why this is done this way?