Selectors, variable assignment and strange behavior?

Selectors, variable assignment and strange behavior?

I am stumped here, when using a selector's name attribute, perform a x.replace() on the variable, then attempting to get the new name of the attribute I am getting the original selector's name.

  1. $j('input[name*=\\[txtProductQuantity\\]]').bind('blur', function() {
  2.  if ($j(this).val()) {
  3.   var x = $j(this).attr('id').replace('txtProductQuantity','txtProductPrice');
  4.   alert(x+' => '+$j('input[name^='+x+']').attr('name'));
  5.  }
  6. });