programer.tips, another cool thing from @nghuuphuoc!

isbn validator

Validate an ISBN (International Standard Book Number). Support both ISBN 10 and ISBN 13

Validators

Improve it on Github

Options

Option HTML attribute Type Description
message data-bv-isbn-message String The error message
When setting options via HTML attributes, remember to enable the validator by setting data-bv-isbn="true".

Example

ISBN Result
9971502100
99921-58-10-7
960 425 059 0
99921-58-10-6
9780306406157
978-0-306-40615-7
978 0 306 40615 7
978-0-306-40615-6
<form id="isbnForm" class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-3 control-label">ISBN</label>
        <div class="col-sm-5">
            <input type="text" class="form-control" name="isbn" />
        </div>
    </div>
</form>
$(document).ready(function() {
    $('#isbnForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            isbn: {
                validators: {
                    isbn: {
                        message: 'The value is not valid ISBN'
                    }
                }
            }
        }
    });
});

Related validators

The following validators might be useful to you: