Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Update:</strong> Ok, then the issue only lies in using double quotes for <code>product</code>. Use single quotes and escape them:</p> <pre><code>document.getElementById('results').innerHTML += '&lt;li&gt;&lt;span contenteditable="true" onkeyup="updateRecord('+item['id']+', \'product\', this)"&gt;' + ...; </code></pre> <p>But you really should consider to refactor your code. E.g. you could write it like this:</p> <pre><code>var results = document.getElementById('results'); var container = document.createDocumentFragment(); for (var i = 0, l = result.rows.length; i &lt; l; i++) { var item = result.rows.item(i); var li = document.createElement('li'); var span = document.createElement('span'); span.setAttribute('contenteditable', 'true'); span.onkeyup = (function(item) { return function() { updateRecord(item['id'], 'product', this); } }(item)); span.innerHTML = item['product']; var a = document.createElement('a'); a.href = '#'; a.onclick = (function(item) { return function() { deleteRecord(item['id']) } }(item)); a.innerHTML = 'x'; li.appendChild(span); li.appendChild(a); container.appendChild(li); } results.appendChild(container); </code></pre> <p>It is more code but easier to maintain in the long run...</p> <hr> <p><s>You have syntax and quotation issues. This should work:</p> <pre><code>onkeyup="updateRecord('item[\'id\']', 'product', this)" </code></pre> <p>But the code seems a bit weird to me. Is this in your actual HTML or are you echoing or printing it? Because </p> <pre><code>&lt;span...&gt;'+ item['product'] + '&lt;/span&gt; </code></pre> <p>looks weird in HTML. It will literally put <code>'+ item['product'] + '</code> inside the <code>&lt;span&gt;</code> tag. Please post a more complete version of your code.</s></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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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