Okay, in my continued pursuit of finding out what I've done wrong, I
hard-coded into the html a block identical to the one that jQuery adds to
the DOM via the "Add an Item" link/button.  When using this, my "Remove this
Item" button/link works perfectly.

In addition, I am using the Highlighter plugin to highlight each form "row"
as it is focused on.  The highlight does not work with the jQuery-added
elements.

These two items have me quite puzzled, as this seems to be
counter-productive behavior.  I'm guessing that it's being caused by
something that I'm doing wrong though, so I am including my "Add an Item"
function so that all of you much brighter (and more experienced) people can
show me the error of my ways.  ;-)

$("a.add-item").click(function() {
    var n = $("div.addtl-item").length;
    var str = "";
    str = '<div id="container-' + n + '" class="addtl-item"><div
class="ctrlHolder"><p class="label">Additional Item #' + (n+1) + '
(Type)</p><label for="addtlType-' + n + '-1" class="inlineLabel"><input
name="addtlType-' + n + '" id="addtlType-' + n + '-1" value="prem"
checked="checked" type="radio" />&nbsp;Premium</label><label
for="addtlType-' + n + '-2" class="inlineLabel"><input name="addtlType-' + n
+ '" id="addtlType-' + n + '-2" value="std" type="radio"
/>&nbsp;Standard</label></div>';
    str = str + '<div class="ctrlHolder"><label for="addtlCategory-' + n +
'"><em>*</em> Additional Item #' + (n+1) + ' (Category)</label><select
name="addtlCategory-' + n + '" id="addtlCategory-' + n + '"
class="selectInput"><option value="">Select One</option></select>';
    str = str + '<div><a href="" id="rmv-' + n + '"
class="remove-item">Remove Additional Listing # '+ (n+1) +
'</a></div></div></div>';
    $("#end-addtl-items").prepend(str);
    return false;
});


Sorry for the lengthy code.  I tried to format it so it'd be easier to read,
but I'm sure that the mail or the list server will jack it all up.


Thanks again,

Matt

Reply via email to