I have a large div with several divs (they mimic <tr>s). In those are
two input type="text" fields and two buttons. None of the elements are
floating, but the "buttons" are actually <a>s that are display: inline-
block.

If I .prepend() or .after() a new div to one of the existing divs
(using the function below), each input and button has just a little of
its left margin removed.

I can fix it with addClass('shift'), where shift is "margin-left: 8px !
important," to the new div with jquery, but it seems kludgy to have to
do so, when the HTML of the new div is exactly the same as the
existing divs.

function x() {
...
        $.ajax({
                type:"POST",
                url:"/ajax-url.php",
                data:{var:var},
                dataType:'json',
                error:function(){stderr();},
                success:function(json){
                        if(json.error) {
                                stderr(json.error);
                                $("#"+json.field).focus().select();
                                return;
                        } else {
// The shift occurs with append(), prepend(), before() and after()
                                $("#tr"+id).after(json.row);
// I can fix it by adding:
                                $("#tr"+json.id).addClass('shift');
// CSS: .shift { margin-left: 8px !important; }
                        }
                }
        });
}


Has anyone else experience this?

Reply via email to