单击重置 Jquery 插件
我已将此 jQuery 条形图插件与我创建的函数绑定在一起。
我的代码在这里小提琴上 http://jsfiddle.net/swordfish0321/9Rkc2/3/
问题: 如果单击“计算”按钮的次数超过一次,它会将文本堆叠在其自身之上,从而导致图形无法使用。我尝试插入一个重置按钮,成功重置表单数据并尝试重置条形图,但实际上只是执行显示和隐藏,问题仍然存在。
问题: 有人知道如何在不刷新页面的情况下重置此计算器和/或在触发一次后将重置功能合并到“计算”按钮中吗?
干杯。
I have tied this jQuery Bar Graph plugin with a function that I created.
My code is on fiddle here
http://jsfiddle.net/swordfish0321/9Rkc2/3/
Problem:
If the 'Calculate' button is clicked more that once it stacks text on top of itself rendering the graph non-useable. I tried inserting a reset button that successfully resets the form data and attempts to reset the bar graph, but really just performs a show and hide and the problem persists.
Question:
Anyone have any ideas of how I could either reset this calculator without a page refresh and/or incorporate the reset functionality into the 'Calculate" button after it's fired once?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正尝试在 DIV 元素上运行
.reset()
。这仅适用于表单。您真正想要做的只是在用户单击“重置”时删除图表。您可以这样做:
$('#chart').empty();
You're trying to run
.reset()
on a DIV element. This will only work for forms.What you want todo is really just remove the charts when a user clicks reset. You can do this like:
$('#chart').empty();