You cant attach a behavior to plain text. Tags like p
and span
dont generate events in browsers, so theres no way to trigger an action from those tags.
However, you can attach a behavior to a link. Therefore, to attach a behavior to text, the easiest approach is to add a null link (that doesnt point to anything) to the text, then attach the behavior to the link. Note that if you do this, your text will appear as a link. You can change the link color and remove the underlining if you really dont want it to look like a link, but site visitors may then be unaware that theres a reason to click that text.
javascript:;
in the Link text box. Be sure to include both the colon and the semicolon.
NOTE |
|
You can instead use a number sign ( |
a
href
tag, insert this attribute: style="text-decoration:none; color:black".
This attribute setting disables underlining and sets the color of the text to black. (Of course, if the surrounding text is a different color, use that color instead of black.)
Note that this attribute is an inline CSS style. An inline style applied to a single link overrides other CSS styles that apply to that link, but has no effect outside of that link. To change the appearance of linked text everywhere on a page or across your entire site, use CSS styles to create a new style for links. For detailed information, see Inserting and Formatting Text.