Hi Claire,
Sorry, but obviously I’m doing something wrong.
I started by placing the function in the head of the page as you suggested:
<script>
function copylist(id)
{
var text = $("#list"+id).html(); // this gives you everything in the div
window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
}
</script>
Then I amended the foreach loop for one list as a test:
<div id="list1">
<button onclick="copylist(1)">Copy list</button>
<?php foreach ($email_signupRecords as $record): ?>
<?php if (($record['email'] && $record['hidden'] == 0 && $record['confirmed'] == 1) && ($record['remove']== 0 || $record['remove']== "")): ?>
<?php echo ($record['email']) ?><br />
<?php endif ?>
<?php endforeach ?>
</div>
It doesn’t seem to matter if the “Button” is inside the div or outside, or whether I change the button from "copylist(1)" to "copylist(list1)".
When I load the page, all I get is an almost white background button that says Copy List that does nothing when clicked.
You can see the result at http://ericaminer.com/emaillistA.php
Log in with the Cookbook credentials that I sent you.
Thanks for you help,
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php