Basically I have a form and a script that loops through all fields(inputboxes, textarea, radio buttons, etc.) within the form. One field is particularly special because I am using flexbox (http://www.fairwaytech.com/flexbox/flexbox-demos/), which is created by using a empty div tag that is defined in jQuery(function($){}). Since my script loops through all fields except the flexbox field because it is a div, I figured I could create a hidden field where the value of that div could be placed in. The script would then loop through all fields + that hidden field containing the value from the div. My problem is getting the value from that div.
Now if I did this in my code
jQuery(function($){
$('#location').flexbox(countries, {
onSelect: function() {
$('#location').html(this.value);
}
});
})
The div containing flexbox will be replaced by the value of the selected item in flexbox. How do I assign the “this.value” to a variable to be put into the hidden field?
For testing purposes, if I do
jQuery(function($){
var flexboxValue;
$('#location').flexbox(countries, {
onSelect: function() {
flexboxValue = $('#location').html(this.value);
for (x in flexBoxValue){
document.write(x + "<br />");
}
}
});
})
it would display a long list of properties. All I need is that selected value from flexbox, not the objects properties. Document.write(x.val) would give me undefined as well as all the listed properties.