Note that there are some explanatory texts on larger screens.

plurals
  1. POWeird behaviour of part of jQuery code
    primarykey
    data
    text
    <p>Ok, lets begin.</p> <p>this code works fine in console, doing what is required from it.</p> <pre><code>$('#tasks-table input').parent().html($('#tasks-table input').siblings('textarea').val()) </code></pre> <p>but in such a call it doesn't even execute. console is silent. all other function code is executed properly</p> <pre><code>updateTask.call(this, 131) </code></pre> <p>any ideas?</p> <p><strong>update</strong></p> <p>this</p> <pre><code>$('#tasks-table input').parent().html($('#tasks-table input').siblings('textarea').val()) </code></pre> <p>is part of this </p> <pre><code>updateTask.call(this, 131) </code></pre> <p>and gets ignored in updateTask this instruction works from console just fine, but does not when it's a part of updateTask</p> <p>html is a 4-row php-generated table with a row typical to this</p> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;?php echo $task-&gt;id ?&gt;&lt;/td&gt; &lt;td onclick='projects.editTask.call(this, &lt;?php echo $task-&gt;id ?&gt;)'&gt;&lt;?php echo $task-&gt;text ?&gt; &lt;/td&gt; &lt;td&gt;&lt;?php echo $task-&gt;status ?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $task-&gt;controls ?&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>editTask is a simple replace function(contents of td turned into textarea)</p> <pre><code>if(block || !($(this).attr('incomplete'))) return; //only one is allowed block = true; if(!$(this).children('textarea').length) { $(this).html('&lt;textarea style="width: 100%; height: 110px;"&gt;'+$(this).html()+'&lt;/textarea&gt;&lt;br/&gt;&lt;input type="button" value="Сохранить" onclick="projects.updateTask.call(this, '+parseInt(id)+')" /&gt;'); } </code></pre> <p>the goal of updateTask is to replace anything within td back to contents of textarea and send an update request back to server using $.post contents of updateTask</p> <pre><code>var text = $(this).siblings('textarea').val(); //does not work only here, but works anywhere else $('#tasks-table input').parent().text($('#tasks-table input').siblings('textarea').val()) $.post('/projects/ajax/', { ajax: true, command: 'update', id: id, text: text } , function() { block = false; }); </code></pre> <p>When I do it more complicated way, it works. more simple way like this one:</p> <pre><code>$(this).parent().html(text) </code></pre> <p>didn't work too</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload