$(function() { $("#modal-test-invoice").on("show.bs.modal", function(event) { var a = $(event.relatedTarget); var id = $(a).data("id"); $(this).find("form").attr("action", "/account/tests/" + id + "/invoice"); $(this).find("input[name=travel_cost]").val("0.00"); }); });