how to access dom element attribute in plugin settings
How can I assign different values to plugin parameters based on dom element -
this - attributes?
Say I have 4 elements:
-
<div class="editme" id="friuts" rel="one">apples</div>
<div class="editme" id="numbers" rel="two">5,6</div>
<div class="editme" id="candy" rel="three">gum</div>
<div class="editme" id="shapes" rel="four">circle</div>
.. that I bind a jquery behavior to:
-
$('.editme').editable('savedata.php',{
loadurl : 'loaddata.php',
});
.. now I want to pass different parameters to the jquery plugin based on the dom element being manipulated.
for example I want to pass the value of the div's rel attribute like this:
-
$('.editme').editable('savedata.php',{
loadurl : 'loaddata.php',
loaddata : {regarding: function(){ return eval($(this).attr('rel'))}}
});
.. but this does not work.. how should it be done?