jQuery add required to input fields
You can do it by using attr, the mistake that you made is that you put the true inside quotes. instead of that try this:
$("input").attr("required", true);
$("input").prop('required',true);
DEMO FIDDLE