Wednesday, 15 January 2014

jquery - IE10 - textbox attribute disabled/enabled -



jquery - IE10 - textbox attribute disabled/enabled -

i have textboxes when user click on 1 of textbox, other textboxes disabled. working fine in firefox, can not understand that, enabling of textbox doesn't work in ie10 (i cannot edit value within textbox when enable(?). below jquery codes, missing ie10? have tried .prop('disable', false), .prop('readonly', false) nil works in ie10 in firefox have no problem. please help.

textbox onclick event:

function disabletboxexceptactivetxbox(txtbox) { $('input[id*="tbxqty"]').attr("disabled", true); $(txtbox).removeattr("disabled"); }

cancel button onclick event:

function cancelupdate(btn) { $('input[id*="tbxorderqty_"]').removeattr('disabled'); }

you should utilize .prop('disabled', true|false) when disabling or enabling textboxes, not attr('disabled', true) , removeattr('disabled'). proper code be:

function disabletboxexceptactivetxbox(txtbox) { $('input[id*="tbxqty"]').prop("disabled", true); $(txtbox).prop("disabled", false); }

update:

it appears first statement causing ie 10 , 11 create current textbox disabled, , despite sec line removing disabled property, ie re-adds when start interacting text box. can see when @ dom explorer while running code.

try code instead:

function disabletboxexceptactivetxbox(txtbox) { $('input[id*="tbxqty"]').not(txtbox).prop("disabled", true); }

see fiddle: http://jsfiddle.net/px6kv/2/

this selects of textboxes, filters out current textbox, sets remaining disabled. interesting bug. i'll file microsoft, if it's not already.

you should consider adding class each of these textboxes rather using [id*="tbxqty"], faster in browsers.

then, cancelupdate:

function cancelupdate(btn) { $('input[id*="tbxorderqty_"]').prop('disabled', false); }

you may want more consistent how you're going abbreviate "textbox", tbx, txtbox, tbox or txbox used. suggestion though :)

jquery asp.net textbox internet-explorer-10

No comments:

Post a Comment