3 Display a link with javascript to replace text within a element.
7 <& /elements/link-replace_element_text.html, {
8 target_id => 'input_id',
9 replace_text => 'hello',
11 element_type => 'input', # Uses jquery val() method to replace text
12 element_type => 'div', # Uses jquery text() method to replace text
21 <a href="<% $param{href} %>"
22 style="<% $param{style} %>"
23 % if ($param{class}) {
24 class="<% $param{class} %>"
26 onClick="$('#<% $param{target_id} %>').<% $param{jmethod} %>('<% $param{replace_text} |h %>');">◁</a>
29 die "template call requires a parameter hashref" unless ref $_[0];
31 # Defaults that can be overridden in param hashref
33 target_id => 'SPECIFY_AN_INPUT_ELEMENT_ID',
34 replace_text => 'REPLACEMENT_TEXT_FOR_INPUT_ELEMENT',
35 element_type => 'input',
37 link_text => '%#x25C1;', # ◁
38 href => 'javascript:void(0)',
39 style => 'text-decoration:none;',
44 $param{jmethod} = $param{element_type} eq 'input' ? 'val' : 'text';