javascript - Creating if for dblclick td -


hello stackoverflow people, ive got problem. im trying put premisions. how can make if user id equal task creator id, let user use onclick functions, if not dont. ive tried doing usernow user, , userown creator:

    if (usernow == userown) {         function editcellvalue(cellelement) { 

but ddnt worked, think should in this:

 $s .= ('<td class="select0" id="start_'.$currenttasken.'" nowrap="nowrap" align="center" ondblclick="mousecords(event);editcellvalue(this)" style="' . $style . '; border: none;" title="'.$appui->_('double click edit date').'">'         . $newstartdata . '</td> 

for example:

ondblclick="if(usernow == userown) { mousecords(event);editcellvalue(this) }"  

but dont know how write correctly. question, how can make if dblclick?

you must remove ondblclick attribute on html.

 $s .= ('<td class="select0" id="start_'.$currenttasken.'" nowrap="nowrap" align="center" style="' . $style . '; border: none;" title="'.$appui->_('double click edit date').'">'     . $newstartdata . '</td> 

and write in javascript (this example jquery)

 $('td').on('dblclick', function(e) {       if(usernow === userown) {           editcellvalue($(this));       }  });   function editcellvalue(cellelement) { .... 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

json - ORA-06502: PL/SQL: numeric or value error: character string buffer too small - Convert Clob to varchar2 -

ios - Swift Array Resetting Itself -