Skip to the content

Notifications

Highlight

Marking what someone searched for, inside the results. Nothing here goes near innerHTML — the text is split into pieces and rendered as text, so a search term can never become markup.

Type to mark

try “sep”, “paid”, or “<b>”

  • INV-0241 Ferrow Manufacturing

  • INV-0239 Northwind Trading

  • INV-0236 Kestrel Logistics

  • BILL-0117 Merrow Print

No note mentions “”.

As a plain mark

when the term is fixed rather than typed

The closing balance is $197,905.00, which agrees with the bank statement to 30 September. The difference against the ledger is nil — every one of the 214 transactions in the period is matched.

The <mark> element is the right tag for this: a screen reader can be told the text is marked, which a coloured <span> cannot convey.

Why not innerHTML

The quick way to highlight is to replace the term with <mark>$&</mark> and assign to innerHTML. That turns every search box on the page into a way to inject markup, and it only takes one field that echoes a name from a database for it to matter.

Splitting the string into hit and non-hit pieces and rendering each as text costs a few lines and closes that door completely. Type <b> into the box above — it is looked for, not executed.

Coffer v1.0.0 Halden & Roe LLP — fiscal year ending 31 Dec 2026 All figures in USD

Are you sure?