I'm new to HTML5 forms and getting them to work in older browsers. I am trying to get my simple HTML5 demo form to validate in IE8 using the Webshims Lib polyfill, but it does not seem to validate. As far a I can tell, I've followed the directions from the Webshims Lib website. What am I doing wrong? Here's my code (below) and live link

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="js/modernizr-custom.js"></script>
<script src="js/polyfiller.js"></script>

<style>
ul {list-style-type: none; margin-top: 100px;}
li {padding-bottom: 10px;}
</style>
</head>

<body>
<form id="myform" action="process.php" method="post">

<ul>
<li><label>Name</label>
<input type="text" name="name"></li>

<li><label>Email</label>
<input type="email" name="email" required></li>

<li><label>Numbers</label>
<input type="number" name="numbers"></li>

<li><label>Message</label>
<textarea name="message" placeholder="Type Here" required></textarea></li>

<li><input id="submit" name="submit" type="submit" value="Submit"></li>
</ul>

</form>

<script>
$.webshims.polyfill();
</script>

</body>
</html>
有帮助吗?

解决方案

You have to copy the whole js-webshim folder into your project. Currently you only have included polyfiller.js. This script only handles the polyfills and includes them from the shim folder.

If you open up your developer console, you will see that you have a lot of 404 requests for js/shims...js.

Some notes as long as you are using only form you should use webshims.polyfill('forms') or webshims.polyfill('forms forms-ext') and not webshims.polyfill(). If you have still problems, you should use the files from the dev folder and open your console.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top