9

What is the difference between focusin / focusout versus focus / blur in jQuery?

 3 years ago
source link: https://www.codesd.com/item/what-is-the-difference-between-focusin-focusout-versus-focus-blur-in-jquery.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

What is the difference between focusin / focusout versus focus / blur in jQuery?

advertisements

This question already has an answer here:

  • Difference between focusin/focusout and focus/blur, with example 2 answers

I was handling some events using the following code with jQuery 1.7.2:

$().on('focus blur', function(event) {
  console.log(event.type);
});

And I have noticed that event.type for both events, prints out: focusin and focusout.

What is difference between focusin/focusout vs focus/blur?


Short answer: focusin    bubbles, focus does not.
        focusout bubbles, blur   does not.
Read the docs:

The focusin event is sent to an element when it, or any element inside of it, gains focus. This is distinct from the focus event in that it supports detecting the focus event on parent elements (in other words, it supports event bubbling).

Related Articles

Difference between focusin / focusout and focus / blur, for example

Can anyone tell me the difference between blur and focusout, focus and focusin with a simple example?The focusin and focusout events bubble, the focus and blur events doesn't. That means that you can use the focusin and focusout on the parent element

What is the difference between async: false and async: true in jquery ajax?

In jquery ajax there should be a parameter $.ajax({async : true, ...}); What is the difference between setting the value to true and false?You set async to false, when you need that ajax request to be completed before the browser passes to other code

What is the difference between take-off and focus to see the controllers?

The app I'm working on will need to implement a workflow to allow users to enter information in a form. Instead of using a scroll view, I'm planning to break it up into a bunch of separate view controllers, which will be managed by a navigation contr

What is the difference between casting and down-casting versus the class variable

What is the difference between up-casting and down-casting with respect to class variable? For example in the following program class Animal contains only one method but Dog class contains two methods, then how we cast the Dog variable to the Animal

What is the difference between the primary key in the table definitions versus the single clustered index

What is the difference between defining the PK as part of the table definition vs. adding it as a unique clustered index. Using the example below, both tables show up as index_id 1 in sys.indexes, but only table1 has is_primary_key=1 I thought this w

What is the difference between adding an element to a JFrame versus a container?

This question already has an answer here: What is the relation between ContentPane and JPanel? 6 answers The code is: JFrame jframe = new JFrame("no difference"); JButton button = new JButton("no difference"); jframe.getContentPane().a

What is the difference between WPF and Silverlight?

What is the difference between WPF and Silverlight? Is it just the same as winforms vs asp as in desktop apps versus web app or is there an overlap?Silverlight is a subset of the functionality in WPF. WPF is desktops, silverlight is cross-platform we

What are the differences between private jre and public jre?

What are the differences between private jre and public jre? Is there some official paper about this topic? I didn't find any question on SO about this topic. Nor I was able to find something fulfilling around.The official answer, from Oracle: Privat

C ++: what is the difference between ostream and ostringstream?

What is the difference between ostream and ostringstream? When would you use one versus the other?Put succinctly: ostringstream provides a streambuf, ostream requires the user to provide one. To understand the implications, it's necessary to understa

What is the difference between ^ and \ A, $ and \ Z in regex?

In regular expressions: What is the difference between ^ and \A? What is the difference between $ and \Z?In single-line mode, $ matches either the end of the string, or just before the newline at the end of the string. In multiline mode $ matches bef

What is the difference between & ldquo; text & rdquo; and New String (& ldquo; text & rdquo;)?

What is the difference between these two following statements? String s = "text"; String s = new String("text"); new String("text"); explicitly creates a new and referentially distinct instance of a String object; String s =

What is the difference between several parameter lists and several parameters per list in Scala?

In Scala one can write (curried?) functions like this def curriedFunc(arg1: Int) (arg2: String) = { ... } What is the difference between the above curriedFunc function definition with two parameters lists and functions with multiple parameters in a s

In Ruby on Rails, what is the difference between installing something like gem or plugin?

On http://github.com/collectiveidea/delayed_job it says: To install as a gem, add the following to config/environment.rb: config.gem 'delayed_job' Run rake gems:install versus To install as a plugin: script/plugin install git://github.com/collectivei

What is the difference between the svg attribute x and dx?

What is the difference between svg's x and dx attribute (or y and dy)? When would be a proper time to use the axis shift attribute (dx) versus the location attribute (x)? For example, I have noticed a lot of d3 examples doing something like this char

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK