Permalink
Browse files

terminal commit

  • Loading branch information...
1 parent 936dabe commit 49689925224e457e24520d757e160025deb718fd @thgreasi committed Aug 25, 2012
@@ -0,0 +1,21 @@
+$(document).ready(function () {
+ var nativedatalist = false;
+ // check if modernizr is available or use the handmade way
+ if (typeof Modernizr != 'undefined' &&
+ typeof Modernizr.input != 'undefined' &&
+ typeof Modernizr.input.list != 'undefined') {
+ nativedatalist = Modernizr.input.list;
+ } else {
+ nativedatalist = !!('list' in document.createElement('input')) &&
+ !!(document.createElement('datalist') && window.HTMLDataListElement);
+ }
+
+ if (!nativedatalist) {
+ $('input[list]').each(function () {
+ var availableTags = $('#' + $(this).attr("list")).find('option').map(function () {
+ return this.value;
+ }).get();
+ $(this).autocomplete({ source: availableTags });
+ });
+ }
+});
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,8 @@
+$(document).ready(function () {
+ $('input[list]').each(function () {
+ var availableTags = $('#' + $(this).attr("list")).find('option').map(function () {
+ return this.value;
+ }).get();
+ $(this).autocomplete({ source: availableTags });
+ });
+});
@@ -0,0 +1,21 @@
+$(document).ready(function () {
+ var nativedatalist = false;
+ // check if modernizr is available or use the handmade way
+ if (typeof Modernizr != 'undefined' &&
+ typeof Modernizr.input != 'undefined' &&
+ typeof Modernizr.input.list != 'undefined') {
+ nativedatalist = Modernizr.input.list;
+ } else {
+ nativedatalist = !!('list' in document.createElement('input')) &&
+ !!(document.createElement('datalist') && window.HTMLDataListElement);
+ }
+
+ if (!nativedatalist) {
+ $('input[list]').each(function () {
+ var availableTags = $('#' + $(this).attr("list")).find('option').map(function () {
+ return this.value;
+ }).get();
+ $(this).autocomplete({ source: availableTags });
+ });
+ }
+});
Oops, something went wrong.
View
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Color Datalist</title>
+</head>
+<body>
+ <input type="text" name="color" id="color" value="" list="colorlist" />
+ <datalist id="colorlist">
+ <option value="Black" />
+ <option value="Blue" />
+ <option value="Dark Green" />
+ <option value="Grey" />
+ <option value="Green" />
+ <option value="Red" />
+ <option value="White" />
+ <option value="Yellow" />
+ </datalist>
+</body>
+</html>
View
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Color Datalist</title>
+</head>
+<body>
+ <input type="text" name="color" id="color" value="" list="colorlist" />
+ <datalist id="colorlist">
+ <select style="display: none;">
+ <option value="Black" />
+ <option value="Blue" />
+ <option value="Dark Green" />
+ <option value="Grey" />
+ <option value="Green" />
+ <option value="Red" />
+ <option value="White" />
+ <option value="Yellow" />
+ </select>
+ </datalist>
+</body>
+</html>
View
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Color Datalist</title>
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" type="text/css" />
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
+</head>
+<body>
+ <input type="text" name="color" id="color" value="" list="colorlist" />
+ <datalist id="colorlist">
+ <select style="display: none;">
+ <option value="Black" />
+ <option value="Blue" />
+ <option value="Dark Green" />
+ <option value="Grey" />
+ <option value="Green" />
+ <option value="Red" />
+ <option value="White" />
+ <option value="Yellow" />
+ </select>
+ </datalist>
+ <script>
+ $(document).ready(function () {
+ var availableTags = $('#colorlist').find('option').map(function () {
+ return this.value;
+ }).get();
+ $('#color').autocomplete({ source: availableTags });
+ });
+ </script>
+</body>
+</html>
View
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Color Datalist</title>
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" type="text/css" />
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
+</head>
+<body>
+ <input type="text" name="color" id="color" value="" list="colorlist" />
+ <datalist id="colorlist">
+ <select style="display: none;">
+ <option value="Black" />
+ <option value="Blue" />
+ <option value="Dark Green" />
+ <option value="Grey" />
+ <option value="Green" />
+ <option value="Red" />
+ <option value="White" />
+ <option value="Yellow" />
+ </select>
+ </datalist>
+ <script>
+ $(document).ready(function () {
+ var nativedatalist = !!('list' in document.createElement('input')) &&
+ !!(document.createElement('datalist') && window.HTMLDataListElement);
+
+ if (!nativedatalist) {
+ $('input[list]').each(function () {
+ var availableTags = $('#' + $(this).attr("list")).find('option').map(function () {
+ return this.value;
+ }).get();
+ $(this).autocomplete({ source: availableTags });
+ });
+ }
+ });
+ </script>
+</body>
+</html>
View
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>Color Datalist</title>
+ <script src="js/modernizr.custom.95515.js"></script>
+ <script>
+ Modernizr.load([
+ 'https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js',
+ {
+ test : Modernizr.input.list,
+ nope : ['https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css',
+ 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js',
+ 'js/DatalistPolyfill.js']
+ }
+ ]);
+ </script>
+</head>
+<body>
+ <input type="text" name="color" id="color" value="" list="colorlist" />
+ <datalist id="colorlist">
+ <select style="display: none;">
+ <option value="Black" />
+ <option value="Blue" />
+ <option value="Dark Green" />
+ <option value="Grey" />
+ <option value="Green" />
+ <option value="Red" />
+ <option value="White" />
+ <option value="Yellow" />
+ </select>
+ </datalist>
+</body>
+</html>

0 comments on commit 4968992

Please sign in to comment.