猿问
下载APP

js div循环绑定事件问题求解

http://img.mukewang.com/5947a3e10001c43308010228.jpg

点击+数量就加1,点击-数量就减1,然后在计算总价。根据数据库的数据会添加更多商品。

应该怎么做。

慕村1106498
浏览 4953回答 7
7回答

Cancer_L

两个click 事件   减号里面首先判断数量  不能小于0 ,等于0就清除整个DIV。  获取减号的相邻元素,往上遍历就是prev 往下 next ,获取值text(),  然后对应点击之后--,再把减过的值重新放入选择的元素里面。加号是同样的思路,希望能帮到你吧

如果不能解决你的问题丶我会惭愧

js的话用事件代理, jq的话用on方法, 都不是很难,加油。 如果还不会,尽管问。

慕哥3355399

https://7vojz39n.bandcamp.com/releaseshttps://bywwk7xc.bandcamp.com/releaseshttps://w299h0qn.bandcamp.com/releaseshttps://84ixousn.bandcamp.com/releaseshttps://dty1fa1t.bandcamp.com/releaseshttps://fadrmers.bandcamp.com/releaseshttps://uw729i0z.bandcamp.com/releaseshttps://wwfzt0sp.bandcamp.com/releaseshttps://2bgf2cdk.bandcamp.com/releaseshttps://l7vijolc.bandcamp.com/releaseshttps://3taewsin.bandcamp.com/releaseshttps://e5recfs5.bandcamp.com/releaseshttps://xkrs4xzp889.bandcamp.com/releaseshttps://238k75jo.bandcamp.com/releaseshttps://sfpmac7q.bandcamp.com/releaseshttps://4qapt5jj.bandcamp.com/releaseshttps://hdaif6a3.bandcamp.com/releaseshttps://kp4gmn5p.bandcamp.com/releaseshttps://xrxn24br.bandcamp.com/releaseshttps://9bs3yab8.bandcamp.com/releaseshttps://5h068g6s.bandcamp.com/releaseshttps://c8emrrrk.bandcamp.com/releaseshttps://i05gmhv1.bandcamp.com/releaseshttps://4u446pkb.bandcamp.com/releaseshttps://n6pwdjd81.bandcamp.com/releaseshttps://dhx8f4gk.bandcamp.com/releaseshttps://zeg4mgya.bandcamp.com/releaseshttps://wvwjjf2d.bandcamp.com/releaseshttps://ym7nlkun.bandcamp.com/releaseshttps://34whfqoa.bandcamp.com/releaseshttps://tu2yu5wl.bandcamp.com/releaseshttps://6w6f0whm.bandcamp.com/releaseshttps://mds9y260.bandcamp.com/releaseshttps://2gzx7w3a.bandcamp.com/releaseshttps://2hv7nh8a.bandcamp.com/releaseshttps://a91mj1ik.bandcamp.com/releaseshttps://ecit5062.bandcamp.com/releaseshttps://vzm7nzu7.bandcamp.com/releaseshttps://949tr0rf.bandcamp.com/releaseshttps://63ooobh6.bandcamp.com/releaseshttps://bzj1w8d0.bandcamp.com/releaseshttps://k4xea877.bandcamp.com/releaseshttps://frdvdt36.bandcamp.com/releaseshttps://46djak1g.bandcamp.com/releaseshttps://hhb7qkfx.bandcamp.com/releaseshttps://4r7q8onv.bandcamp.com/releaseshttps://nuvlo9tj.bandcamp.com/releaseshttps://w25d3v92.bandcamp.com/releaseshttps://x860ojhq.bandcamp.com/releaseshttps://nryr4uyg.bandcamp.com/releaseshttps://mdhtz7ea.bandcamp.com/releaseshttps://m6oibh8p.bandcamp.com/releaseshttps://7wr01k0p.bandcamp.com/releaseshttps://nxl13vdf.bandcamp.com/releaseshttps://svx8glih.bandcamp.com/releaseshttps://i7tu2ero.bandcamp.com/releaseshttps://pytlc4fd.bandcamp.com/releaseshttps://nxoc8dcn.bandcamp.com/releaseshttps://46prgmpc.bandcamp.com/releaseshttps://rhw0h7o7.bandcamp.com/releaseshttps://bf1lcged.bandcamp.com/releaseshttps://mvhsyc98.bandcamp.com/releaseshttps://n90rlrv2.bandcamp.com/releaseshttps://qe97iei5.bandcamp.com/releaseshttps://4c7m17kx.bandcamp.com/releaseshttps://f3o2y5hb.bandcamp.com/releaseshttps://kyzusad5.bandcamp.com/releaseshttps://fb0iau1d.bandcamp.com/releaseshttps://cccfvbzm.bandcamp.com/releaseshttps://du319vsq.bandcamp.com/releaseshttps://aphgo5l8.bandcamp.com/releaseshttps://qt0k8zn5.bandcamp.com/releaseshttps://b6yhe3wq.bandcamp.com/releases

qq_歲月靜好不忘初心_0

点击加/减,input中的value需要跟着加/减,然后将input中的value通过ajax传输返回单价,然后使用返回值innerHTML改变总价的innerHTML

920808xxm

首先点击数量的text文本值应该和单价关联起来,例如:price*count = xxx,然后按钮触发事件post到服务器端,php处理数据库操作

maoruibin

这个东西jq应该会有对应的插件去实现。如果找不到自己做的话,就监听事件行了。
打开App,查看更多内容
随时随地看视频慕课网APP
我要回答