Skip to content

Commit

Permalink
MDL-55841 core: Allow copy box to be used multiple times in one template
Browse files Browse the repository at this point in the history
  • Loading branch information
John Okely committed Oct 25, 2016
1 parent 919b9df commit 23146ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/templates/copy_box.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Interface element to contain text that the user should copy. Will automaticaly select when clicked.
Classes required for JS:
* none
* copy_box
Data attributes required for JS:
* none
Expand All @@ -31,10 +31,10 @@
Example context (json):
{ "text": "Copyable text"}
}}
<input type="text" class="copy_box" value="{{{ text }}}" readonly="readonly" id="copy_box-{{uniqid}}"/>
<input type="text" class="copy_box" value="{{{ text }}}" readonly="readonly" size="48" {{#id}}id={{#quote}}{{{id}}}-{{{uniqid}}}{{/quote}}{{/id}}/>
{{# js }}
require(['jquery', 'theme_bootstrapbase/bootstrap'], function($) {
$('#copy_box-{{uniqid}}').on('click', function() {
$('.copy_box').on('click', function() {
$(this).select();
});
});
Expand Down

0 comments on commit 23146ba

Please sign in to comment.