Reputation: 5148
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
Upvotes: 4
Views: 196
Reputation: 236022
$('#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.
Upvotes: 3
Reputation: 8166
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...
}
Upvotes: 0
Reputation: 943605
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.
Upvotes: 0