blakefberlacherf
New Member
I am writing a function to update an order receipt every time the user updates and then closes a product pop-up overlay. The function searches each input of the form, and then adds the info to the receipt div if its value is greater than \[code\]0\[/code\]. I am trying to get the \[code\].html()\[/code\] of the label element situated above the input field and which describes the current item, and to use this as the description of the item in the receipt. I have tried using without success:\[code\] - $this.closest('label').html() - $this.prev('label').html() - $this.find('label').html() - this.element.find('label').html()\[/code\]Here is my code. The section I am talking about is the 'label is' part... \[code\]function updateOrder(){var items = '';$('input').each(function(){ var $this = $(this), i_value = http://stackoverflow.com/questions/13853700/$this.attr('value'); if(i_value > 0){ items += $this.attr('id') + ' Quantity: ' + i_value + '<br/>' + 'label is: ' + $this.closest('label').html() + '<br/>'; }});$('#d_reciept').html(items);\[/code\]}and a sample form item\[code\]<tr><td class="td_thumbs"> <div> <a class="fancybox" data-fancybox-group="vinyl-banners" href="http://stackoverflow.com/questions/13853700/img/products/vinyl-corporateblue.jpg"> <img src="http://stackoverflow.com/questions/13853700/img/products/thumbs/vinyl-corporateblue-thumb.png" alt="vinyl c-blue"/></a> <label>Corporate Blue</label> </div></td><td>6</td><td> <input id="vinyl-blue" type="number" max="6" min="0" value="http://stackoverflow.com/questions/13853700/0"/></td></tr>\[/code\]