First add jquery
in your code
and use on() in place of live().
Also write your code in $(function(){...})
so, that your code will work after document ready
<script src="http:/code.jquery.com/jquery-1.9.1.js"></script>
<script>
$(function () {
$(".repeat").on('click', function () {
var $self = $(this);
$self.after($self.parent().clone());
$self.remove();
});
});
</script>
Updated, if you want it to work for more inputs
then try this,
$(function () {
$(".repeat").on('click', function (e) {
e.preventDefault();// to prevent form submit
var $self = $(this);
$self.before($self.prev('table').clone());// use prev() not parent()
//$self.remove();// remove this line so you can add more inputs
});
});