Skip to content Skip to sidebar Skip to footer

Jquery Fill In Form Input Text Value

On page load I would like jquery to load the UUID method as a value to the UUID field so that I see it passed as a parameter on submit. This and this SO post helped, but Im still n

Solution 1:

Your GUID function lacks a return to return the value it produces for you:

functionGUID ()
 {
     return'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c)
     {
        var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
        return v.toString(16);
     });
 }

It looks like it returns something the way you formatted the braces, but in fact the return v.toString(16) belongs to the anonymous callback function being used by replace to populate each digit with a random hexdecimal digit.

Post a Comment for "Jquery Fill In Form Input Text Value"