I am currently using the code found at http://jsfiddle.net/NvynC/663/ and it works great except for one thing...
This code triggers the resizeInput() function shown in the fiddle...
$('input[type="text"]')
// event handler
.keyup(resizeInput)
// resize on page load
.each(resizeInput);
It triggers it when the page first loads and again on each "keyup" but I have added some additional code that updates various text fields based on values changed in other fields. I am stumped as to what the code would be to resize all fields at a given time when I need it.
The below code is not the code I am using but to simply things, if you could tell me what code would be used if I called it in the following fashion, I'll be able to figure out how to put it in my actual code....
function resize_fields()
{
// WHAT CODE GOES HERE ????
}
resize_fields();
Update to give you a better understanding of what I am doing...
Here is the code I use... In my form...
<select name="user" id="user" onchange=update_user_fields(this.value)>
<option></option>
Scripts...
<script>
function update_user_fields(id)
{
user[id]();
}
user[<?php echo $user->ID; ?>] = function()
{
// I do a bunch of field value changes here and they work perfectly
// ///////
// What I do not know is how to call the resizeInput function referred to in the fiddle above
// ///////
}
</script>
I tried put the following code in the above section where I am missing the code but it DOES NOT WORK!
jQuery(function($) {
$('input[type="text"]')
// resize all
.each(resizeInput);
});
So it turns out that I have a thick skull... The answer below was correct after all.. Here is the working code...
<select name="user" id="user" onchange=update_user_fields(this.value)>
<option></option>
Scripts...
<script>
function update_user_fields(id)
{
user[id]();
}
user[<?php echo $user->ID; ?>] = function()
{
// I do a bunch of field value changes here and they work perfectly
// ///////
jQuery(function($) {
$('input[type="text"]').keyup();
});
// ///////
}
</script>