JavaScript Focus inputs on double click? input focus double click

I want to prevent input focus onclick and focus inputs on double click.

Something like....

$('input').click(function) {
    $(this)preventFocus();
});

$('input').dblclick(function) {
    $(this)focus();
});

Or maybe I should use an if statement?

Answer:1

I guess something like this should work :

$('input').on({
    focus: function() {
        if (!$(this).data('disabled')) this.blur()
    },
    dblclick: function() {
        $(this).data('disabled', true);
        this.focus()
    },
    blur: function() {
        $(this).data('disabled', false);
    }
});

FIDDLE

Answer:2

I have an animation when my checkboxes are checked, but I want to reverse the animation when they are unchecked. I tried the pseudo class :unchecked, which I found did not work. Is there a CSS3 ...

I have an animation when my checkboxes are checked, but I want to reverse the animation when they are unchecked. I tried the pseudo class :unchecked, which I found did not work. Is there a CSS3 ...

  1. uncheck checkbox css

To keep it simple, sat at my desk wondering if there is a difference in efficiency between (in JavaScript): var i = 0; for(i=0; i<Something.length; i++) foo(); for(i=0; i<Something.length; i++...

To keep it simple, sat at my desk wondering if there is a difference in efficiency between (in JavaScript): var i = 0; for(i=0; i<Something.length; i++) foo(); for(i=0; i<Something.length; i++...

  1. what more efficient ac or dc
  2. what's more efficient than led
  3. what more efficient
  4. which is more efficient in converting biomass
  5. which is more efficient recursion or iteration
  6. which is more efficient otto or diesel

I have a Hyperlink where I am Calling a function Openlink which is a follows function OpenLink() { window.open("http://192.168.1.21/Sample/download.asp?Filename=Sample.html&Filepath=E:\Sample\...

I have a Hyperlink where I am Calling a function Openlink which is a follows function OpenLink() { window.open("http://192.168.1.21/Sample/download.asp?Filename=Sample.html&Filepath=E:\Sample\...

I'm testing the SignalR(1.1.0) Chat sample under IIS 7.5. I'm, trying to connect from a diferent webapp to my SignalR webapp(cross-domain). I have made the cross-domain configuration at my web....

I'm testing the SignalR(1.1.0) Chat sample under IIS 7.5. I'm, trying to connect from a diferent webapp to my SignalR webapp(cross-domain). I have made the cross-domain configuration at my web....