Reputation: 1861
<input type="checkbox" onclick="myFunc()" />
myFunc is somewhat long running, about a second, and the browser shows the check for the checkbox AFTER the function completes. This causes lots of issues with users.
I'd like the check to show up immediately and then the onlick function to run. Can that be done?
I know I should get the function to run faster, or redesign the user interface, but that's another issue for another time.
thanks
Upvotes: 3
Views: 92
Reputation: 10305
first of all you should not use onclick="myFunc()"
here's my solution:
$(function() {
$("input[tpe='checkbox']").click(function(e) {
e.preventDefault();
$(this).attr("checked", "checked");
// your code here ...
});
});
Upvotes: 0