1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-02-27 00:54:15 +01:00

Update - Examples: Column filtering now uses placeholder attribute

- Rather than using Javascript to show a placeholder, use the HTML5
  `placeholder` attribute. That is what it is there for and is supported
  by all current shipping browsers (IE9- do not support it, but will not
  break)
This commit is contained in:
Allan Jardine 2013-02-02 15:46:38 +00:00
parent b4aee323bd
commit 8dcd96f300

View File

@ -25,32 +25,6 @@
/* Filter on the column based on the index of this element's parent <th> */
oTable.fnFilter( this.value, $("tfoot th").index($(this).parent()) );
} );
/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("tfoot input").each( function (i) {
asInitVals[i] = this.value;
} );
$("tfoot input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );
$("tfoot input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("tfoot input").index(this)];
}
} );
} );
</script>
</head>
@ -483,11 +457,11 @@
</tbody>
<tfoot>
<tr>
<th><input type="text" name="search_engine" value="Search engines" class="search_init" /></th>
<th><input type="text" name="search_browser" value="Search browsers" class="search_init" /></th>
<th><input type="text" name="search_platform" value="Search platforms" class="search_init" /></th>
<th><input type="text" name="search_version" value="Search versions" class="search_init" /></th>
<th><input type="text" name="search_grade" value="Search grades" class="search_init" /></th>
<th><input type="text" name="search_engine" placeholder="Search engines" /></th>
<th><input type="text" name="search_browser" placeholder="Search browsers" /></th>
<th><input type="text" name="search_platform" placeholder="Search platforms" /></th>
<th><input type="text" name="search_version" placeholder="Search versions" /></th>
<th><input type="text" name="search_grade" placeholder="Search grades" /></th>
</tr>
</tfoot>
</table>
@ -509,32 +483,6 @@ $(document).ready(function() {
/* Filter on the column (the index) of this element */
oTable.fnFilter( this.value, $("tfoot input").index(this) );
} );
/*
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
* the footer
*/
$("tfoot input").each( function (i) {
asInitVals[i] = this.value;
} );
$("tfoot input").focus( function () {
if ( this.className == "search_init" )
{
this.className = "";
this.value = "";
}
} );
$("tfoot input").blur( function (i) {
if ( this.value == "" )
{
this.className = "search_init";
this.value = asInitVals[$("tfoot input").index(this)];
}
} );
} );</pre>
<style type="text/css">
@import "../examples_support/syntax/css/shCore.css";