3

I'm using the HTML input type and you know that the standard validation is very permissive.

Consider this markup:

<form>
    <input type="url" name="link" value="http://jsfiddle .net/" required>
        
    <button type="submit">OK</button>
</form>

I want to add a custom pattern attribute to check that the user can't provide any space.

<input type="url" name="link" pattern="what to do here?" required>

You can fork this fiddle: http://jsfiddle.net/t6dtbhqo/

1 Answer 1

4

why not try pattern="[^\s]+" please see this link i think it is working

<form>
<input type="url" name="link" value="http://jsfiddle .net/" pattern="[^\s]+"  title="please dont use the white space :)" required>

<button type="submit">OK</button>

Sign up to request clarification or add additional context in comments.

1 Comment

title="please dont use the white space :)" ...... and see this link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.