javascript - how to access object property using variable -


i have object

var messages = { 'fullname' : 'tell cool name dude..! e.g. yousuf iqbal', 'username' : 'choose catchy username. remember! should available :)', 'password' : 'choose top secret password special chars, numbers , alphabets', 'repassword' : 'retype password typed. but, don\'t try copy!', 'byear' : 'tell year, in bomb blasted' }; 

and variable..

var attribute = $('#userinfo form input').attr('name'); 

now want select messages object property using variable this..

var message = messages.attribute; 

but not working.. , have tried following..

var message = messages+'.'+attribute; 

square brackets:

message = messages[ attribute ]; 

Comments

Popular posts from this blog

Glib GIOChannel -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -

python - Obscure curses error message when creating a sub window -