Code: Select all
var max_chars = 10; if($('#req_raport_nr').val().length > max_chars) { $('#req_raport_nr').val($('#req_raport_nr').val().substr(0, max_chars))}
I would like to have it as an function where I could use for example onblur with:
Code: Select all
limit_char('req_raport_nr',5)
or even better
limit_char(5) - if it can recognize field ref.
Code: Select all
function limit_char(field,qty) {
which code ??
}