TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sangeetha k
NA
207
51.6k
Copy to clipboard with label value followed by a ; and text
Feb 13 2019 12:02 AM
I wish to copy contents to a clipboard in this format
LAbel : input textbox value
but the jquery which i found seems to give this format
Label
text
label
text
Pls someone give a appropriate way to sought out this.
#html code along with jquery .
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CopyClip.aspx.cs" Inherits="CopyClip.CopyClip" %>
<!DOCTYPE html>
<html>
<head>
<style>
input[type=text], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
textarea, select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
<title></title>
<script src="Scripts/jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function () {
$("#copyclick").click(function () {
var id = $(this).attr('id');
var el = document.getElementById('div1');
var range = document.createRange();
range.selectNodeContents(el);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
document.execCommand('copy');
})
})
</script>
</head>
<body>
<div id="div1">
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="your name..." />
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="your last name...." />
<label for ="country">Country</label>
<select id="country" name="country">
<option value="australia">Australia</option>
<option value="canada">Canada</option>
<option value="usa">USA</option>
</select>
<label for ="myInput">Textarea</label>
<input type="text" value="Hello World" id="myInput">
<label for="textarea">MultilineArea</label>
<textarea rows="5" cols="100" id="textarea"></textarea>
<button id="copyclick"onclick=" myFunction()">Copy text</button>
</div>
</body>
</html>
Reply
Answers (
10
)
Dynamic XAML Content for a Rating page module in Xamarin For
unreachable code detected