I am trying to get the ckeip jquery plugin to parse the id of my textarea to my php file.
The plugin is activated by the class name of my textarea:
$('.ckeip_edit').ckeip({
And then data is passed to my php file with an object literal:
data: {
name1 : 'value1',
name2 : 'value2'
},
I need to use the id attribute of my textarea in one of these so tried:
data: {
name : 'value',
id : function(){this.getAttribute("id")}
},
But this doesn't seem to work.
Can I use variables in an object literal?
In this case you want a .each()
and use this
where needed inside to get an attribute from the current element for usage, like this:
$('.ckeip_edit').each(function() {
$(this).ckeip({
data: {
name : 'value',
id : this.id
},
//options...
});
});