Skip to content

Instantly share code, notes, and snippets.

@1stevengrant
Created September 26, 2013 21:53
Show Gist options
  • Save 1stevengrant/6721123 to your computer and use it in GitHub Desktop.
Save 1stevengrant/6721123 to your computer and use it in GitHub Desktop.
Breaks Matrix out into individual fields in a safecracker form
$(".addrow").click(function(){
var m = Matrix.instances[0]; // gets the first Matrix instance on the page
m.addRow();
return false;
})
$(".remrow").click(function(){
var m = Matrix.instances[0]; // gets the first Matrix instance on the page
m.removeRow(m.totalRows - 1); // removes the last row
return false;
})
<a href="#" class="addrow">Add Row</a>
<a href="#" class="remrow">Remove Row</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment