Home > Article > Web Front-end > Some little knowledge about js and code sharing
The content of this article is to share some small knowledge points about js and code sharing. It has a certain reference value. Friends in need can refer to it
The first method returns false when clicked 2. When clicked, make the button unavailable, such as disabled
var feedbtnlock = 0;function bonus_passwd() { if (feedbtnlock == 0) { feedbtnlock = 1; setTimeout(function(){ feedbtnlock = 0; }, 1500); } else { alert('请勿重复点击!'); return false; } }
validate 2. validfrom
<form id="add_form" method="post" enctype="multipart/form-data"> <input type="text" name='title' value=''></form><script>$("#add_form").validate({ rules : { title: { required : true } }, messages : { title: { required : '标题不能为空' } } });</script>
artdialog
<body> <button data-event="test">open dialog</button> <script src="artDialog-master/lib/jquery-1.10.2.js"></script> <script src="artDialog-master/dist/dialog.js"></script> <script> $('button[data-event=test]').on('click', function() { var d = dialog({ title: '消息', content: '风吹起的青色衣衫,夕阳里的温暖容颜,你比以前更加美丽,像盛开的花<br>——许巍《难忘的一天》', okValue: '确 定', ok: function() { var that = this; setTimeout(function() { that.title('提交中..'); }, 2000); return false; }, follow: this, cancelValue: '取消', cancel: function() {} }); d.show(); }); </script></body>
Related recommendations:
##JS pop-up window method summary
js makes a simple div pop-up window
The above is the detailed content of Some little knowledge about js and code sharing. For more information, please follow other related articles on the PHP Chinese website!