Ok, to update… I’ve found if I add one instruction, hit save, and add another, it seems to be saving them…
That seems to put it in this javascript code…
<script type="text/javascript">
jQuery("button.instructionDelete").live('click', function() {
if (jQuery("table#instructions tr").length <= 2) {
alert("At least one instruction is needed!");
}
else {
// alert("Deleted :)");
jQuery(this).parent().parent().addClass("delete");
jQuery(this).parent().parent().fadeOut('20000', function(){
jQuery(this).find("input").val("");
});
}
return false;
});
jQuery("button#instructionAdd").live('click', function() {
var instrLastID = parseInt(jQuery("table#instructions tr").last().attr("id").replace("instruction-", ""));
var instrLastNo = parseInt(jQuery("table#instructions tr").last().find("td.colInstrItem").text());
var instrNewID = parseInt(instrLastID+1);
var newRow = '\
<tr id="instruction-' + instrNewID + '">\
<td class="colInstrItem">' + parseInt(instrLastNo+1) + '</td>\
<td class="colInstrTitle">\
<input type="text" class="instrTitle" name="_my_meta[recipeInstruction][' + instrNewID + '][title]" value="">\
</td>\
<td class="colInstrActions">\
<button class="instructionDelete">X</button>\
</td>\
</tr>\
';
// alert(newRow)
// alert("last ingredient id: " + instrLastID + "\nnew ingredient id: " + instrNewID)
jQuery("table#instructions tbody").append(newRow);
return false;
})
</script>