Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>so what you can do for <code>updateQty</code> is have one function that will be correct for all products in a list just by making a function that finds all the necessary elements by relative paths.</p> <pre><code>//in this function the context is the element, so the //`this` variable can be used rather than a param //for the product id function updateQty() { //show the update link var parent = this.parentNode; //assumes only the update text uses the class bodyTiny, and that there //is only one element using it. obviously making this invariant true //would be trivial by adding a different class name var updateText = parent.getElementsByClassName("bodyTiny")[0]; updateText.style.display = 'block'; var updateLink = updateText.parentNode , updateHref = updateLink.href; //next we find the current quantity and replace it with the input updateHref = updateHref.replace(/qty=(\d*)/, 'qty='+this.value); //then we set the link element's attribute updateLink.href = updateHref; //now when you mouse over the link you should see the url has changed } </code></pre> <p>You can also set your form to <code>POST</code> the equivalent data, and then I guess on the server side you will have your <code>OnGetPage</code> and <code>OnPostback</code> both delegate to the same method with the parameters either parsed out of the query string or out of the post data.</p> <p>You can see it running <a href="http://jsfiddle.net/ejHRn/1" rel="nofollow">on jsfiddle</a>. Hopefully this helps!</p>
 

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