tags:

views:

613

answers:

3

The old inline js code looked like this:

onchange="alias_generator(this,document.forms['category_form'].alias)" onkeyup="alias_generator(this,document.forms['category_form'].alias)"

This just means: copy from the 1. input (title) (this) ... filter it with the alias_generator (that removes special character) and move it to the 2. input (alias).

i'am new to jquery and external js - would be great if someone can help me with that.

allready did some that works onload, but does not update...

var title = document.forms['admin'].title;

var alias = document.forms['admin'].alias;

alias_generator(title,alias);
+1  A: 
$(".myInputFieldClass").keyup(
    function(){
        cur_val = $(this).val(); // grab what's in the field
        // do stuff with cur_val so that it's what you want
        $(this).val(cur_val);
    }
);

That should do it. Good luck.

inkedmn
This looks to be taking the value from field one, processing it, and then putting it back into field one. Be sure to take the processed value and put it into field 2.
Sonny Boy
A: 
$(document.forms["admin"].title).keyup(function (e) { 
    var val = $(this).val();
    // Do stuff with val
    $(document.forms["admin"].alias).val(val);
})
adamse
A: 

working like a charm, thank you

Henry