Skip to main content

Bug Tracker

Side navigation

#6872 closed bug (invalid)

Opened August 04, 2010 05:41PM UTC

Closed August 05, 2010 12:07AM UTC

Last modified March 13, 2012 10:05PM UTC

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'.

Attachments (0)
Change History (1)

Changed August 05, 2010 12:07AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed
I am not sure if this can be considered a bug or not,

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.