Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

a tag with "data-method" and "data-confirm" attributes - how does it work?

Tags:

html

Are those data attributes part of hmtl5? Are they used by jQuery? I though data- attributes are generic. Why does one bring up a confirmation box and how does the link be converted to POST when data-method is post?

I have searched for these attributes in the web but could not find anything useful. I just saw those attributes are often mentioned with ruby stuff.

Is there any official documentation?

Update:

I found out know that they are used in Yii2. However, it seems that other (ruby) frameworks using those attributes in the same way (example). That seems to be the reason why I've got the impression that it is part of jQuery or html5.

like image 744
robsch Avatar asked Oct 01 '15 11:10

robsch


1 Answers

Are those data attributes part of hmtl5?

Data attributes are. Those specific ones are not. The whole point of data attributes is that they are for custom extensions.

Are they used by jQuery?

Only in the sense that it provides an API to interact with data attributes in general.

I though data- attributes are generic.

They are.

Why does one bring up a confirmation box and how does the link be converted to POST when data-method is post?

Because JavaScript code on the page looks for them.

Is there any official documentation?

The spec.

like image 175
Quentin Avatar answered Sep 19 '22 13:09

Quentin