fix for adding the 'required' property

as the name implies, small bug fix. See the changes, 'required' needs to be added using prop() instead of attr()