Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery text() and val() returning null
    primarykey
    data
    text
    <p>EDIT: Seems i didnt use an 'id' on my textarea, so that problem has cleared up but i'm still getting a few problems with text()</p> <pre><code>var e = $('textarea#cost-'+i).val(); // e = 1 (for first iteration) alert($('p#subtotal-'+i).text()); // alert 'subtotal' which is the text in my p#subtotal-1 $('p#subtotal-'+i).text().replaceWith(e); // &lt;- this is the problem, i think alert($('p#subtotal-'+i).text()); // no alert box at all </code></pre> <p>and this time i made sure they all have ids.</p> <hr> <p>The following code, generates an alert box with nothing in it. If i change it to val() it says 'undefined'</p> <hr> <pre><code>$('textarea.costbox').live('blur',function() { for(var i in items) { alert('iteration '+i); alert('textarea#cost-'+i); var e = $('textarea#cost-'+i).text(); alert('cost '+e); } }); </code></pre> <hr> <pre><code>&lt;textarea name="cost-1" class="costbox"&gt;&lt;/textarea&gt; </code></pre> <hr> <p>The idea for this code is to update a subtotal when the value has been changed. This is the last piece of the puzzle.</p> <p>All the HTML looks normal when i inspect it in chrome. And all the rest of my code is working fine.</p> <p>This should be running with modernizer1.7 and jQuery1.5.1, based off recent HTML5Boilerplate.</p> <p>Here's another example of the same basic thing - <a href="http://jsbin.com/obeho5/3/edit" rel="nofollow">http://jsbin.com/obeho5/3/edit</a></p> <p>Its probably something simple but i've been stuck here for hours and can't see it.</p> <p>[if its not something obvious and simple i can post more code]</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. 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