Skip to content

Commit

Permalink
Fixed pasting issue with input type=button elements
Browse files Browse the repository at this point in the history
Moved the various buttons around in the demo
  • Loading branch information
Mathachew committed Feb 21, 2015
1 parent 81d1073 commit ea1b39c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.9.2 (2015-02-20)

Bug fixes:

* fixed an issue with input elements that are a button type having their text being overwritten when pasting and modified the demo to test against the bug (#79)
* included a pull request that restores an element's original maxlength value


## 1.9.1 (2015-02-04)

Bug fixes:
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery.autotab",
"version": "1.9.1",
"version": "1.9.2",
"description": "A jQuery plugin that provides auto-tabbing and filtering on text fields in a form.",
"main": [ "./js/jquery.autotab.min.js" ],
"homepage": "https://github.com/Mathachew/jquery-autotab",
Expand Down
26 changes: 15 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,15 @@ <h1>jQuery Autotab Demo</h1>
<div>
<label for="all1">Any and all characters with tabbing support on non-text form fields. Textarea will auto tab when the defined <code>maxlength</code> is reached, disabled fields are skipped entirely, and the select list will auto tab when a value is selected. Auto tabbing on select lists only applies for single select and is configurable using <code>tabOnSelect</code>.</label>

<input type="text" id="all1" class="all" maxlength="5" size="4">
<input type="text" id="all2" class="all" maxlength="3" size="1" disabled="disabled" value="zxy">
<input type="text" id="all3" class="all" maxlength="5" size="4">
<br>
<button value="button">Standard Button</button> <input type="submit" value="Submit Button"> <button value="button" disabled="disabled">Disabled Button</button> <input type="button" value="Input Button">
<input type="text" class="all" maxlength="5" size="4">
<button value="button">Standard Button</button>
<input type="text" class="all" maxlength="3" size="1" disabled="disabled" value="zxy">
<input type="text" class="all" maxlength="5" size="4">
<input type="submit" value="Submit Button">
<input type="text" class="all" maxlength="5" size="4">
<button value="button" disabled="disabled">Disabled Button</button>
<input type="text" class="all" maxlength="5" size="4">
<br> <input type="button" value="Input Button">
<br>
<select>
<option>First</option>
Expand All @@ -310,17 +314,17 @@ <h1>jQuery Autotab Demo</h1>
<br>
<textarea cols="20" rows="2" maxlength="10" class="all"></textarea>
<br>
<input type="text" id="all4" class="all" maxlength="5" size="4">
<input type="text" class="all" maxlength="5" size="4">
<br>
Email: <input type="email" id="all5">
Email: <input type="email">
<br>
Number: <input type="number" id="all6" maxlength="3">
Number: <input type="number" maxlength="3">
<br>
Tel: <input type="number" id="all7" maxlength="10">
Tel: <input type="number" maxlength="10">
<br>
Range: <input type="range" id="all8">
Range: <input type="range">
<br>
URL: <input type="url" id="all9">
URL: <input type="url">
</div>
<pre>
// Note: This call is not necessary as 'all' is the default format
Expand Down
6 changes: 3 additions & 3 deletions js/jquery.autotab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Autotab - jQuery plugin 1.9.1
* Autotab - jQuery plugin 1.9.2
* https://github.com/Mathachew/jquery-autotab
*
* Copyright (c) 2008, 2015 Matthew Miller
Expand Down Expand Up @@ -540,7 +540,7 @@
defaults.arrowKey = false;

// Prevent the browser from of navigating to the previous page
if (this.type === 'select-one' || this.type === 'select-multiple' || this.type === 'checkbox' || this.type === 'radio' || this.type === 'button' || this.type === 'submit' || this.type === 'range') {
if (!defaults.editable) {
$(this).trigger('autotab-previous', defaults);
return false;
}
Expand Down Expand Up @@ -691,7 +691,7 @@

var defaults = getSettings(e);

if ($(e).prop('disabled') || $(e).prop('readonly')) {
if ($(e).prop('disabled') || $(e).prop('readonly') || !defaults.editable) {
$(e).trigger('autotab-next');

if (!settings.iOS) {
Expand Down
Loading

0 comments on commit ea1b39c

Please sign in to comment.