How To Move Up Or Down A Text Row In Javascript
I'm facing a the problem about move up or move down a text row, when I move up or down a row, it can move but seem old row is still exist and was not deleted for example: I move
Solution 1:
Your question is lacking HTML context. Anyway, removing option from select seems to be wrong
I changed your code like this.
function down_move(index)
{
var frm = document.writeForm;
var elSelect = frm["ans_list" + index];
var opts=elSelect.options
for (var i=opts.length-1; i>=0; i--) {
if (opts[i].selected && i<opts.length-1) {
tmp = opts[i].cloneNode(true);
tmp.selected=true;
// opts[i].removeChild(true);
elSelect.remove(i);
elSelect.add(tmp, i + 1);
}
}
setting_val(index);
}
Post a Comment for "How To Move Up Or Down A Text Row In Javascript"