Skip to content

Instantly share code, notes, and snippets.

@rsl
Created August 12, 2009 17:00
Show Gist options
  • Save rsl/166611 to your computer and use it in GitHub Desktop.
Save rsl/166611 to your computer and use it in GitHub Desktop.
function insert_fields(link, method, content) {
var new_id = new Date().getTime();
var regexp = new RegExp("new_" + method, "g")
$(link).up().insert({
before: content.replace(regexp, new_id)
});
}
function remove_fields(link) {
var hidden_field = $(link).previous("input[type=hidden]");
if (hidden_field) {
hidden_field.value = '1';
}
$(link).up(".fields").hide();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment