1

I just googled how to check if an div is initialized as a dialog.

$(this).is(':data(dialog)');

I don't fully understand above code.
Is this means that every initialized dialog has a variable "dialog" and it is set as true ?
Is data() as selector here is the same as in $.data() function ?
Any article should I read ?

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
Hendry H.
  • 1,482
  • 3
  • 13
  • 27

1 Answers1

2

This makes an error.

If there was a :data pseudo-selector it would test if it applies. And it would return a boolean but not change anything.

But there is no :data pseudo selector if you're not using a specific plugin. See reference.

Note that some people have created such a pseudo-selector : jquery data selector

But it's not standard and of course the result would depend on the plugin you use. In "vanilla jQuery", $(this).is(':data(dialog)'); just makes an error.

Community
  • 1
  • 1
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758