Not able to use JS to copy an iframe to the clipboard

Hi guys, the title says it all i just wanna copy the iframe text into the clipoard so i can send it to the database. thanks

<!DOCTYPE html>
<html>
<head>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Dashboard</title>

   	<link rel="stylesheet" type="text/css" href="../css/font-awesome-4.7.0\css\font-awesome.min.css">
   
    <link rel="stylesheet" type="text/css" href="../css/app.css">
    <link rel="stylesheet" type="text/css" href="../js/textEditor.js">

</head>
<body onLoad="enableEditMode();">
	<div>
		<div class="selectors">
			<button class="textBut" onclick="execCmd('bold')"><i class="fa fa-bold"></i></button>
			<button class="textBut" onclick="execCmd('italic')"><i class="fa fa-italic"></i></button>
			<button class="textBut" onclick="execCmd('underline')"><i class="fa fa-underline"></i></button>
			<button class="textBut" onclick="execCmd('strikeTrough')"><i class="fa fa-strikethrough"></i></button>
			<button class="textBut" onclick="execCmd('justifyLeft')"><i class="fa fa-align-left"></i></button>
			<button class="textBut" onclick="execCmd('justifyCenter')"><i class="fa fa-align-center"></i></button>
			<button class="textBut" onclick="execCmd('justifyRight')"><i class="fa fa-align-right"></i></button>
			<button class="textBut" onclick="execCmd('justifyFull')"><i class="fa fa-align-justify"></i></button>
			<button class="textBut" onclick="execCmd('subscript')"><i class="fa fa-subscript"></i></button>
			<button class="textBut" onclick="execCmd('superscript')"><i class="fa fa-superscript"></i></button>
			<button class="textBut" onclick="execCmd('insertUnorderdList')"><i class="fa fa-list-ul"></i></button>
			<button class="textBut" onclick="execCmd('insertOrderedList')"><i class="fa fa-list-ol"></i></button>
			<select class="textBut" name="" id=""  onchange="execCommandWithArg('formatBlock', this.value);">
				<option value="H1">H1</option>
				<option value="H2">H2</option>
				<option value="H3">H3</option>
				<option value="H4">H4</option>
				<option value="H5">H5</option>
				<option value="H6">H6</option>
			</select>
			<button class="textBut" onclick="execCmd('insertHorizontalRule')">HR</button>
			<button class="textBut" onclick="execCommandWithArg('createLink', prompt('Enter a URL', 'http://'));"><i class="fa fa-link"></i></button>			
			<button class="textBut" onclick="toggleEdit();">Toggle Edit</button>
			<select class="textBut" name="" id="">
				<option value="Arial">Arial</option>
				<option value="Comis Sans MS">Comic Sans MS</option>
				<option value="Courier">Courier</option>
				<option value="Georgia">Georgia</option>
				<option value="Tahoma">Tahoma</option>
				<option value="Times New Roman">Times New Roman</option>
				<option value="Verdana">Verdana</option>
			</select>
			Fore Color : <input class="textBut" type="Color" onchange ="execCommandWithArg('foreColor',this.value);"/>
			Background Color : <input  class="textBut" type="Color" onchange ="execCommandWithArg('hiliteColor',this.value);"/>
			<button class="textBut" onclick="execCommandWithArg('insertImage', prompt('Enter the image URL', ''));"><i class="fa fa-file-image-o "></i></button>

		</div>
		<iframe name="richtextfield" frameborder="0" class="richtextfield"></iframe>
	</div>
	
	<div>
		<button id="article" onclick="copyToClipboard();"> Upload Article</button>
	</div>
	<script type="text/javascript" >
	var content=window.frames['richtextfield'].document.body.innerHTML´╗┐	;
		var isInEditMode=true;
		function enableEditMode(){
			richtextfield.document.designMode='On';
		}
		function execCmd(command){
			richtextfield.document.execCommand(command,false,null);
		} 
		function execCommandWithArg(command, arg){
			richtextfield.document.execCommand(command,false,arg);
		}
		function toggleEdit(){
			if(isInEditMode){
				richtextfield.document.designMode='Off';
				isInEditMode=false;

			}
			
			else{richtextfield.document.designMode='On';isInEditMode=true;}
		}
		function copyToClipboard() {
			window.frames['richtextfield'].document.body.innerHTML´╗┐.select();
		  document.execCommand('copy');
		}
	</script>
</body>
</html>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.