html
<button>a</button>
<div class="headerer">
<p>visit <a href="http://reigel-codes.co.cc">reigel-codes.co.cc</a></p>
</div>
problem
how can I add checkbox after <button> by pressing and hold left click ?.. then stop adding when left click is release…
I have tried so far,
$(document).ready(function(){
$('button').mousedown(function(){
$(this).after('<input type="checkbox">')
});
})
mousedowndoesn’t have an automatic repeat, but you could create one viasetIntervaland then turn it off onmouseupviaclearInterval. E.g.:Be sure to test your target browsers, I wouldn’t be 100% certain some of them don’t eat
mousedownandmouseupon buttons.Edit Shout out to jAndy for the point about
mouseleave, edited the above to use it.