you can try this
if(!Modernizr.inputtypes.range)
{
document.write("Your browser version does not support range");
}
题
When I run the below code for Modernizr to check for range it's not giving me the expected result. The function is called though the condition is true or not. What I'm trying to do is to run the function only when the range input type is not supported by the browser otherwise it should not be called.
<!DOCTYPE html>
<html>
<head>
<script src="modernizrdev.js"></script>
<script>
if(!Modernizr.range)
{
document.write("Your browser version does not support range");
}
</script>
</head>
<body>
<form action="demo_form.asp" method="get">
Points: 0<input type="range" name="points" min="1" max="10">10
<input type="submit">
</form>
</body>
</html>
解决方案
you can try this
if(!Modernizr.inputtypes.range)
{
document.write("Your browser version does not support range");
}
其他提示
If I understand the docs correctly it is:
<!DOCTYPE html>
<html>
<head>
<script src="modernizrdev.js"></script>
<script>
if(!Modernizr.inputtypes.range)
{
document.write("Your browser version does not support range");
}
</script>
</head>
<body>
<form action="demo_form.asp" method="get">
Points: 0<input type="range" name="points" min="1" max="10">10
<input type="submit">
</form>
</body>
</html>
More info: http://www.browserleaks.com/modernizr
I think you might need
Modernizr.inputtypes.range