Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion numeric/jquery.numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,19 @@ $.fn.numeric.keypress = function(e)

$.fn.numeric.keyup = function(e)
{
// Determine if it is a paste action (CTRL+V or SHIFT+INS)
var paste = false;
// get the key that was pressed
var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
// allow or deny Ctrl+V (paste), Shift+Ins
if((e.ctrlKey && key == 118 /* firefox */) || (e.ctrlKey && key == 86) /* opera */
|| (e.shiftKey && key == 45)) {
paste = true;
}

var val = $(this).val();
if(val && val.length > 0)
// Only process pate on key up event. Then CTRL+A, Y, Z ... actions will be process normally.
if(val && val.length > 0 && paste)
{
// get carat (cursor) position
var carat = $.fn.getSelectionStart(this);
Expand Down