I'm curious... can you specify an HTML attribute that is empty or valueless?
The W3 spec allows for empty attributes like so:
<input type="checkbox" disabled checked>
And with MVC, you declare inputs like this:Html.CheckBoxFor(m=>m.Foo)
.
You can add Html Attributes with the Html.CheckBoxFor(m=>m.Foo, new {@class="myCssClass"})
syntax, but you can't do Html.CheckBoxFor(m=>m.Foo, new { disabled, checked})
I know the spec also allows for self-value attributes for these kinds (e.g. new {disabled="disabled"}
) and empty string values (e.g. new {disabled=""}
).
I'm just curious if there is any way to specify the empty syntax.
When an HTML tag contains an attribute with no value set (indicated by no information between the quotation marks) it is said to have an "empty" attribute.
Html. ActionLink creates a hyperlink on a view page and the user clicks it to navigate to a new URL. It does not link to a view directly, rather it links to a controller's action.
No, standard HTML helpers doesn't support this. You could write a custom HTML helper and build the markup yourself.
Late to the party, but ... this from w3schools:
"In XHTML, attribute minimization is forbidden, and the disabled attribute must be defined as: select disabled="disabled".
So for compliance, don't even try to use attribute minimization? But it seems the HTML helpers don't allow it anyway.
http://www.w3schools.com/tags/att_select_disabled.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With