I have a form that I want to auto save based on the inputs changing value, but am having problems with my selector. My problem seems to be specifically with the inputs I am trying to exclude as the function still fires when those inputs change.
$('#OrderDetailsTabs').on('change',
'form[id^="frmWorkOrderHdr"] input[type=text],form[id^="frmWorkOrderHdr"] input[type=number], form[id^="frmWorkOrderHdr"] select, form[id^="frmWorkOrderHdr"] textarea, input:not("#WOHdr_FinishedGoodsItemId_AutoComplete, .itemSelectorCategory1, .itemSelectorCategory2")',
function () {
saveWOHdr(event, this);
})
So for example, when input #WOHdr_FinishedGoodsItemId_AutoComplete
changes, the saveWOHdr
event is still firing and the this
object is indeed the #WOHdr_FinishedGoodsItemId_AutoComplete
input.
The selector I have so far is what I came up with after reading this other SO answer.
I think the inclusionary selector string I have could also be cleaned up to reduce the repetitive form[id^="frmWorkOrderHdr"]
parent qualifier...but I didn't want to get too fancy until I got it at least performing the way I want.