Numbas
Numbas copied to clipboard
Substitute variables into the alt attribute without eval-alt
In HTML which has JME values substituted into it, such as the question statement, you can set an attribute on a tag from a JME expression by adding eval-
to the attribute name.
For example, in
<p eval-class="{classname}"></p>
the class
attribute will use the value of the classname
question variable.
For images, the alt
attribute is set by the rich text editor, but it'd be nice to have it sub in variable values instead.
So, in DOMcontentsubber.sub_element
, I think that the attribute alt
should have the same behaviour as attributes matching the regex eval-(.*)
Can I try for this issue?
@lawrencetheabhorrence thanks for offering! Please have a look at our guide on contributing to Numbas, and instructions on setting up a development environment
I see that this issue has been open for quite a while. So is it ok if I take this up?
Hi @prakha thanks for offering! Yes, please have a go at this.