Bug Tracker

Modify

Ticket #6872 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

Change History

comment:1 Changed 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.