I’m using text boxes to let users change the quantity in a ecommerce website, e.g., http://nordschleife.metaforix.net/118/118/index.php/sony.html
There are two problems that I hope to solve:
-
On the catalog view (such as the one from the previous URL), the up and down arrows only work for the 1st text box. All subsequent entries don’t work.
-
After clicking an arrow, the page goes to the top, which is not what I intend as well.
PHP is used to generate the entries, jQuery is used for the actions.
The source file for the page is here http://www.mediafire.com/?sharekey=9df4aef22a728de5c2b435915e8821d7e04e75f6e8ebb871
1: Instead of registering an event for every arrow separately you can make only one script for all of them. Make an arrow look like this:
an then register these functions as click event handlers:
2: To prevent goin to the top of the page use
href="javascript:void(0);"instead ofhref="#"in your links. Alternatively your onclick method might return false to prevent default action (i.e. changing the location of your web page).