Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I need some help to how to split my username (firstname & surename) into two textboxes with javaScript code

im trying to do it with is code...but i get error


JavaScript
function onGetUserNameSuccess() 
{
    $('#message').text('Hello ' + user.get_title());

    var text1 = user.get_title();
    var result = text1.split('--');
    document.getElementById('#txtNamn').value = result[0];
    document.getElementById('#txtEfternamn').value = result[1];
}
Posted
Updated 3-Mar-15 22:16pm
v2
Comments
King Fisher 4-Mar-15 4:20am    
what is your username?

 
Share this answer
 
Comments
[no name] 4-Mar-15 5:28am    
Hi King Fisher..one of your text box getting undefined value..please chk it.
King Fisher 4-Mar-15 5:32am    
your username must be like 'king--Fisher' or 'Rajeesh--Menoth'
[no name] 4-Mar-15 5:39am    
:)
King Fisher 4-Mar-15 5:43am    
;)
Member 11313120 4-Mar-15 5:33am    
thnxx King Fisher
how can i split a text from a div to 2 textboxes when i started the page (without any buttons)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900