views:

63

answers:

3

hey guys

i create two input text fields , one for title and another for permanent link

i need to update the second filed automatically when user is typing the tilte

how can i do such a thing in jquery /php

somehow im looking for a way to simulate wordpress creation of permanent link in post section

A: 

Write a function to read from the current input, munge it however you like, and insert it into the other input.

Then bind that function to the keypress and change events.

David Dorward
A: 

You can intercept keyup event on the first input text, and then update the output of the second input:

    $('#titleInput').keypress(function(e) { alert ('typed' + String.fromCharCode(e.keyCode))//update your 2nd input text... 
}
mamoo
+3  A: 
$('#first_input_id').bind('keydown', function(e){
     var inputmirror = $('#second_input_id');
     inputmirror.val(inputmirror.val() + String.fromCharCode(e.which));
});

something similar to this should do it.

Kind Regards

--Andy

jAndy
thanks , u r so smart to write that code , but when i erase letters in first input box , it insert undefined character instead of updating the second input box
Mac Taylor