Looks like you gathering the data to send via ajax or something, am I right?
If so, you would want to try this:
$('#yourform')
.find(":input, :checkbox, :radio, :password, :hidden")
.not(":button, :reset")
.each(function() {params[ this.name ||
this.id || this.parentNode.name ||
this.parentNode.id ] = this.value;});
All the data from the form will be stored as an array in the var params like 'name': 'value',
you can send this as extra params with ajax after converting it to Json, e.g.,
var json = JSON.stringify(params)
$.post('processdata.php', data: json)
Then at php, you replace some extra \" by ", decode as an array and be happy!
Rodolfo.
James escreveu:
No, it doesn't remove the class when you change the drop-down option.
You have to add an onchange event to the select field to tell it to
remove the class (from all options) and add the class to the current
selected option.
On Mar 19, 3:23 am, jjsanders <jigalroe...@gmail.com> wrote:
Hello,
When i select something from a selectbox it adds a class to the
selected option this way:
$('div#tabs input[type="text"], select option:selected, input:checked,
textarea').addClass('takethis');
But when i select a different option it doesn't remove the class
'takethis' from the option which I first selected.
How can I force this?
Thanks in advance.