javascriptjquerytextboxonbluriscroll4

Remove focus from textbox when iscroll region is clicked


I have defined some events when input textbox has got focus and some task to perform when focus is removed. I am also using iscroll4 but textbox is out of the scroller. My problem is when textbox gets focus and i click on the iscroll area the foucs from textbox is not going. But if i click on area outside iscroll the foucs is removing from the textbox. I am not understand why clicking on the iscroll region does not remove the focus whereas click events work. I have defined the blur event.


Solution

  • I am using iscroll4 and in the iscroll.js file there is the following event defined :

    onBeforeScrollStart: function (e) {
        if (e.preventDefault) {
            e.preventDefault(); 
        }
    }
    

    I commented the e.preventDefault line and it worked for me. This was basically preventing the blur event to fire when i clicked on the iscroll region because this is the first event that iscroll fires when it receives any mouse down event.