You must Sign In to post a response.
  • Category: JQuery

    how to copy text on button click event

    i want to copy text from textbox on button click event in jquery , and work code in all browser compatible , so i am new in these tech so please give me ans.

    thanks,
    Ss
  • #762327
    Hi

    You can try this Code for copy one textbox to another textbox



    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>

    <script>
    $(document).ready(function() {
    $('#txtFirst').keyup(function(e) {
    var txtVal = $(this).val();
    $('#txtSecond').val(txtVal);
    });

    $('#txtSecond').keyup(function(e) {
    var txtVal = $(this).val();
    $('#txtFirst').val(txtVal);
    });
    });
    </script>


    First Name :<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
    Second Name :<asp:TextBox ID="txtSecond" runat="server"></asp:TextBox>



    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762343
    sir i want to button click event copy the text from textbox .

  • #762347
    Hi

    you can try this Code for button click copy one textbox to another textbox value change



    <script>
    $(document).ready(function () {
    $('#Btsubmit').click(function () {
    $('#txtSecond').val($('#txtFirst').val());
    return false;
    });
    });
    </script>

    First Name :<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
    Second Name :<asp:TextBox ID="txtSecond" runat="server"></asp:TextBox>

    <asp:Button ID="Btsubmit" runat="server" Text="Clicks" />


    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762348
    sir i want to copy text in clipboard and anywhere i paste these text i found in enternet explore but not work in chrome. following is my code.

    window.clipboardData.setData("Text", $("#ContentPlaceHolder1_SelectedUC_txtProductSerialKey").val());


    but clipboarddata not defined in chrome.

  • #762351
    Hi

    You can go through Below links

    http://stackoverflow.com/questions/22581345/jquery-click-button-copy-to-clipboard

    http://www.paulund.co.uk/jquery-copy-clipboard


    http://www.codeproject.com/Questions/614175/Copy-text-to-Clipboard-using-JQuery


    http://javascript-html5-tutorial.com/copy-to-clipboard-in-javascript-jquery-zclip.html

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #762355
    sir i want to copy text in clipboard and anywhere i paste these text i found in enternet explore but not work in chrome. following is my code.

    window.clipboardData.setData("Text", $("#ContentPlaceHolder1_SelectedUC_txtProductSerialKey").val());


    but clipboarddata not defined in chrome.

  • #762430
    Hello Mohan,

    Go through the below link for reference :

    http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript

    It contains that much information which may satisfy your requirement and solve your problem.

    Hope this will help you.

    Regards,
    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"


Sign In to post your comments