Hello, I have a problem with my code - I made a function to manage "divs" - moving them up, down or remove them (these divs are in one "container div" and I am using jQuery .each function to rebuild them to an array).... its working really nice, but .... I can move these boxes only up when I click on down arrow, it does nothing... but the script is working well, I tried it by alert and many times checked the code - I am lost ... here is the script:
Code:
function move_element(which, where){
var begin = new Array();
var end = new Array();".
var elements = new Array();
var found = new Array();
var old_elements = make_array("positions");
for(i=0;i<old_elements.length;i++){
if(i < where && i != which){
begin.push(old_elements[i]);
}else if(i == which){
found[0] = old_elements[i];
}else if(i >= where){
end.push(old_elements[i]);
}
}
$("#form_inputs_add").html(begin.concat(found,end).join(""));
refresh_controls();
}
make_array() will make an array , refresh_controls just update up, down arrows(delete up for first element and so)....I will be glad for every help .... thank you. If you need more code or so, just ask.
... why ? jQuery is more easy and it works same ... I do with jQuery just retriving html
$("#form_inputs_add .element").each(function(){
bla bla bla ....
});
and then saving it back(edited):
$("#form_inputs_add").html(elements);
.... why to dont use it ? this is simpleir - I think problem isnt here ... For "up" arrow it works well and fast - down arrows work, but it DONT change the positions - but the "algorithm" looks well :/ try to look at it too - maybe I just missed a little problem ... I really dont see anything wrong :/
are you asshole ? did you read my post ? tell me what is bad on jQuery ? Why to dont use it, when I use it almost everywhere and it is usefull ... tell me ....
Bookmarks