#6872 closed bug (invalid)
selector, variable assignment, replace and value of replaced variable
Reported by: | jas | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.2 | |
Component: | selector | Version: | 1.4.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I am not sure if this can be considered a bug or not, maybe just unexpected behavior within the library.
Here is the code I am working with:
$j('#addProduct').click(function() {
$j('input[name*=
[txtProductQuantity
]]').each(function() {$j('input[name*=
[txtProductQuantity
]]').bind('blur', function() {if ($j(this).val()) {
var x = $j(this).attr('id').replace('txtProductQuantity','txtProductPrice'); alert(x+' => '+$j('input[name='+x+']').attr('name'));
}
});
});
});
As you can see the click event executes a selector to bind events too. During the bind process function execution I am replacing the bind name with another at which time I attempt to get the name attribute.
For whatever reason it reverts back to the 'txtProductQuantity' prior to being replaced with 'txtProductPrice' and assigned to 'x'.
If you determine that it is a bug, please reopen the ticket with a complete test case. You can get general jQuery help in the forum.