MyInternships.in

HTML5 MathML

HTML5 MathML <maction> Tag

The <maction> element binds an interactive action - such as toggling between two expressions - to part of a formula. It is a legacy interactivity element from earlier MathML versions and has limited support in modern MathML Core browsers.


Definition and Usage

The <maction> element wraps one or more sub-expressions and declares an action, chosen with the actiontype attribute, to perform on them. Historic values include toggle (cycle through children on click), statusline and tooltip. The selection attribute records which child is currently shown.

Syntax

Basic maction structure
Example
<maction actiontype="toggle" selection="1">
  <mn>1</mn>
  <mn>2</mn>
</maction>

Attributes

AttributeDescription
actiontypeThe kind of action, e.g. toggle, statusline or tooltip.
selection1-based index of the child currently displayed (for toggle).

Example

The document shows the intended structure. Even where the toggle action is not implemented, the selected child renders, so a formula still appears.

An maction toggle expression
Example
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>MathML maction</title>
</head>
<body>
  <p>Expression using maction:</p>
  <math display="block">
    <maction actiontype="toggle" selection="1">
      <mrow>
        <mi>a</mi><mo>+</mo><mi>b</mi>
      </mrow>
      <mrow>
        <mi>b</mi><mo>+</mo><mi>a</mi>
      </mrow>
    </maction>
  </math>
</body>
</html>
⚠️

<maction> is not part of the MathML Core baseline and most modern browsers ignore its interactivity, rendering only the selected child. For real interactivity, use JavaScript to swap MathML on click.

Key Takeaways

  • <maction> attaches an action such as toggle to a sub-expression.
  • actiontype sets the behaviour; selection chooses the visible child.
  • Interactivity is largely unsupported in MathML Core - use it only as a fallback container.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships