0

I'm looking to automatically alter some HTML via VTL--in this case, insert extra values into HTML elements. For instance, if the core HTML I'm dealing with is

<img src="image.jpg" alt="">

I'd want to be able to dynamically find the alt tag to place text. Now, in most cases this would be very straightforward; you'd do something like

<img src="image.jpg" alt="${altText}">

What I'm interested in is knowing if there's a way to select the alt attribute without having to explicitly define the variable. Can I dynamically create such a variable with Velocity? I don't even particularly care if it defines all alt tags as the same or splits them out per instance.

Casey Grimes
  • 117
  • 12
  • Why don't you use JavaScript (jQuery) instead? – Jay Feb 16 '17 at 07:44
  • In this particular case, there's no reasonable way to use JavaScript (propietary platform)--otherwise I'd just use something a la document.getElementsByTagName. Basically, I'm trying to see if there's a Velocity-only way to do exactly that. – Casey Grimes Feb 17 '17 at 17:22

0 Answers0