I have the value in an td attribute 'field', but I can not find a proper way to check or validate its value.
i.e.
<td class="edit" field="qcat_id" user_id="1">MyCat</td>
The way I tried:
function makeEditable(element) {
console.log (element);
if (element.field =="qcat_id"){
alert('yes');
}
}
It will never show yes, and the console.log
returns the whole <td>...</td>
as string.
Update======================
Below is the code where gather the element
parameter
$(function() {
$(document).on("dblclick", "td.edit", function(){ makeEditable(this); });
});
Thank you all