Toggle navigation
Bootsnipp
Bootstrap
For
CSS Frameworks
Bootstrap
Foundation
Semantic UI
Materialize
Pure
Bulma
References
CSS Reference
Tools
Community
Page Builder
Form Builder
Button Builder
Icon Search
Dan's Tools
Diff / Merge
Color Picker
Keyword Tool
Web Fonts
.htaccess Generator
Favicon Generator
Site Speed Test
Snippets
Featured
Tags
By Bootstrap Version
4.1.1
4.0.0
3.3.0
3.2.0
3.1.0
3.0.3
3.0.1
3.0.0
2.3.2
Register
Login
"^^"
Bootstrap 3.0.0 Snippet by
ricardoard12
3.0.0
jQuery
Preview
HTML
JS
View Full Screen
Forked from
Fork
Fork this
Parent
363
 
0 Fav
Post to Facebook
Tweet this
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="alert alert-info"> Please Wait...</div> <div class="alert alert-success" style="display:none;"> <span class="glyphicon glyphicon-ok"></span> Drag table row and cange Order</div> <table class="table"> <thead> <tr> <th> Column heading </th> <th> Column heading </th> <th> Column heading </th> </tr> </thead> <tbody> <tr class="active"> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr class="success"> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr class="warning"> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> <tr class="danger"> <td> Column content </td> <td> Column content </td> <td> Column content </td> </tr> </tbody> </table> </div> </div> </div>
(function ($) { $.fn.extend({ tableAddCounter: function (options) { // set up default options var defaults = { title: '#', start: 1, id: false, cssClass: false }; // Overwrite default options with user provided var options = $.extend({}, defaults, options); return $(this).each(function () { // Make sure this is a table tag if ($(this).is('table')) { // Add column title unless set to 'false' if (!options.title) options.title = ''; $('th:first-child, thead td:first-child', this).each(function () { var tagName = $(this).prop('tagName'); $(this).before('<' + tagName + ' rowspan="' + $('thead tr').length + '" class="' + options.cssClass + '" id="' + options.id + '">' + options.title + '</' + tagName + '>'); }); // Add counter starting counter from 'start' $('tbody td:first-child', this).each(function (i) { $(this).before('<td>' + (options.start + i) + '</td>'); }); } }); } }); })(jQuery); $(document).ready(function () { $('.table').tableAddCounter(); $.getScript("http://code.jquery.com/ui/1.9.2/jquery-ui.js").done(function (script, textStatus) { $('tbody').sortable();$(".alert-info").alert('close');$(".alert-success").show(); }); });
Related:
See More
Free Template
BLK• Design System
Questions / Comments:
Post
Posting Guidelines
Formatting
- Now
×
Close
Donate
BTC: 12JxYMYi6Vt3mx3hcmP3B2oyFiCSF3FhYT
ETH: 0xCD715b2E3549c54A40e6ecAaFeB82138148a6c76