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

php - Hide output during test execution -

javascript - Migrate custom AngularJS filter from 1.2.28 to 1.4.x -

Update Magento products with multiple images -