Mathachew / jquery-autotab

A jQuery plugin that provides auto tabbing and filtering on text fields in a form
http://autotab.mathachew.com/
366 stars 98 forks source link

about data-xxx attribute #49

Closed lsw0529 closed 10 years ago

lsw0529 commented 10 years ago

jQuery Autotab support "data-autotab-format" data attribute on HTML element, is possible to add a new feature like "data-autotab-target" or "data-autotab-previous" data attribute

thanks !

Mathachew commented 10 years ago

@lsw0529 To access those fields, use jQuery's data method: var target = $('selector').data('autotab-target') var previous = $('selector').data('autotab-previous')

In one of the previous Autotab releases, I was using setAttribute and getAttribute, but I failed to realize that I couldn't store anything as the attribute's value. I changed it back to use data, but separately for each setting because it already covers the logic necessary to support any type of object.