I saw this on a question recently.
<input type="radio" mess="whats up" name="q1" value="A" class="correct"/>
I can't get what the mess
attribute do, and I couldn't see any result on the internet. So what is the mess
attribute for?
I saw this on a question recently.
<input type="radio" mess="whats up" name="q1" value="A" class="correct"/>
I can't get what the mess
attribute do, and I couldn't see any result on the internet. So what is the mess
attribute for?
It can be called as custom attributes intended to store a piece of information (purely for developer puropse)but it not advisable.
Instead you can go for HTML5 custom data attribute
like
data-mess="whats up"
It can be easily accessed with .data() in jQuery.
<input type="radio" data-mess="whats up" name="q1" value="A" class="correct"/>
See
$('.correct').data('mess') // to getch the value
$('.correct').data('mess', 'some value') //to update the value
FYI:*custom data-
** is purely validated with w3c validator. Whereas not with yours.
It's just a way to store arbitrary data in the tag. It does whatever the programmer intends it to do. Some people prefer to add custom attributes via data-foo
, others prefer this syntax.
There is no mess
attribute, in the question he just used it to attr
and get the value through JQuery.
For example:
checked = $('input:checked').attr('mess');
sets checked to whatever the checked input had on the 'mess
attribute', as seen in the question.
Another example:
$('#BobDiv').attr('txt');
will return 'Bob' if your HTML is <div id = 'BobDiv' txt = 'Bob' />
As seen here, you have to amend it in your !DOCTYPE declaration, though.