One issue I encountered is using jQuery to dynamically add new elements, only to find that the CSS isn't being applied correctly to the newly added element.
To illustrate this problem, I created a jsFiddle. In the example, there are differences in spacing between the newly added input text boxes.
Here's a snippet of the HTML code:
<fieldset>
<div class="control-group custom">
<label class="input-mini" for="first">Start</label>
<label class="input-mini" for="first">End</label>
<label class="input-mini" for="first">Share</label>
</div>
<div class="control-group custom">
<input type="text" class="input-mini">
<input type="text" class="input-mini">
<input type="text" class="input-mini">
</div>
<div>
<a id="plus_time_button" class="btn plus" href="#">
<i class="icon-plus-sign"></i>
</a>
</div>
</fieldset>
Below is a portion of the JS code used:
$("#plus_time_button").live("click", function () {
var new_row = "<div class=\"control-group custom\"><input type=\"text\" class=\"input-mini\"><input type=\"text\" class=\"input-mini\"><input type=\"text\" class=\"input-mini\"></div><div><a id=\"plus_time_button\" class=\"btn plus\" href=\"#\"><i class=\"icon-plus-sign\"></i></a></div>";
$("fieldset div:last-child").remove();
$("fieldset").append(new_row);
});
And here is some of the CSS code utilized:
.custom label {
padding: 4px 6px;
margin-right: 20px;
display: inline-block;
text-align: center !important;
}
.custom input {
margin-right: 20px;
}
I did come across a similar question, but unfortunately, it didn't provide a solution to my specific problem.