[javascript] Checking if an input field is required using jQuery