Keyup attribute 'name' change not working

Posted by dclowd9901 on Stack Overflow See other posts from Stack Overflow or by dclowd9901
Published on 2010-05-16T20:51:23Z Indexed on 2010/05/16 23:00 UTC
Read the original article Hit count: 159

Filed under:
|
|

Hey guys, I've got what I imagine is a simple question, but for some reason, I can't get it working right.

Expected Behavior: I type characters into a field, and, through a function, those characters are translated into the value of the name HTML attribute.

Actual Behavior: Reflected in Firebug, the value doesn't change or update.

The Code:

$('input').live('keyup', function() {
    var name_value = $(this).val().toLowerCase();
    $(this).attr('name', name_value);
});

Just a side note: I'm using .live() because the element can be cloned, and those clones need to also be able to take on the properties of this .keyup event.

Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about input