What is the difference between prop ('disabled', 'disabled') and prop ('disabled', true)

I use jQuery to disable the option in the dropdown list. I need to know the difference between using

prop('disabled','disabled')

and

prop('disabled',true)

Both work quite a lot on all browsers (not sure if I missed any tho), but on another post I said that it uses disable, true. Can anyone please elabarate? Thanks

+5
source share
1 answer

According to the specification of W3C forms, the attribute is disabled by the boolean attribute ,

therefore prop('disabled',true)is correct.

prop('disabled','disabled')also works because the string 'disabled'is true.

+11
source

All Articles