Js And Yii

how to conect the values (string) of two fields and get its output automatically in the third field in a form.

first field: "Kevin"

Second field: "Spacey"

and it will complete the third field to: "Kevin S."

[size="3"]here is a simple jquery script


// declare new property

var firstField = $('#first-field').val()

   , secondField = $('#second-field').val()

   , thirdField = firstField + " " + secondField[0];


$('#third-field').val(thirdField);



[/size]

thenks i’ll try it.

do u have a clue how i take only the first letter of secondFiled?




 secondField[0]; // this right here does the exactly same

ohh you so right!

thenks for the help