Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all of you,

I'm a beginner in JQuery and I want to assign one textbox value to another textbox. I have written a code for that like:
XML
<script type="text/javascript">
    $("#btnTest").click(function(event) {
        event.preventDefault();
        $("#txtLastName").val() = $("input:txtFirstName").val();
    });
</script>

but it's not working.
Can anybody please help me through this?
I'm waiting for your answer.
Posted
Updated 30-Jan-11 20:49pm
v4

1 solution

Syntax for setting a value of a text box in jQuery is:

$("input:txtFirstName").val("something");

I guess you know the problem now. ;)
 
Share this answer
 
Comments
suhas gadhe 31-Jan-11 2:44am    
thanx i got it!!!!!!!!!

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