I found a simpler solution that requires neither adding element nor a special class.
found it there: http://www.sencha.com/forum/archive/index.php/t-141560.html
And converted the code to jquery :
function hideKeyboard(element) {
element.attr('readonly', 'readonly'); // Force keyboard to hide on input field.
element.attr('disabled', 'true'); // Force keyboard to hide on textarea field.
setTimeout(function() {
element.blur(); //actually close the keyboard
// Remove readonly attribute after keyboard is hidden.
element.removeAttr('readonly');
element.removeAttr('disabled');
}, 100);
}
You call the function by passing it the input from which the keyboard was opened, or just passing $('input') should also work.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…