Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
$(function () {
        $('#<%=Button2.ClientID%>').click(function () {
            $("#popupdiv1").dialog({
                title: "ORANGE",
                width: 430,
                height: 250,
                modal: true,
                     <pre lang="text">buttons: {
                         close: function () {
                         $(this).dialog('close');
                    }
                }
            });


What I have tried:

i want copy the content from the popup window using mentionend code chane to the copy function
buttons: {
                         close: function () {
                         $(this).dialog('close');

please help me
Posted
Updated 20-Jan-23 4:36am
v3
Comments
Member 15627495 20-Jan-23 10:06am    
var copy = $(this);
Member 15900030 20-Jan-23 10:27am    
hi please i am beginer from jquery i am not understanding please reply content

1 solution

Your question is very vague, based on what I understand you need something like this -
1. Open the modal form
2. read its html
3. Copy the html
4. Show it in say a text area element...

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a  href="#">Click here to open dialog
    <svg id="OpenDialog" width="20px" height="20px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M16 2H7.979C6.88 2 6 2.88 6 3.98V12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 10H8V4h8v8zM4 10H2v6c0 1.1.9 2 2 2h6v-2H4v-6z"/></svg>
  </a>    

    <br> 
    </br>
  <div class="data_copy">
    <p>html data to copy</p>
    <p>test</p>
    <input type="text" />
    <button type="button">testing </button>
  </div>
<script>
$(document).ready(function () {
    $("#OpenDialog").click(function () {
        var w = window.open("", "popupWindow", "width=600, height=400, scrollbars=yes");
        var $w = $(w.document.body);
        $w.html("<textarea></textarea>");
    });
});
</script>
 
Share this answer
 
Comments
Member 15900030 20-Jan-23 10:37am    
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="newpop.aspx.cs" Inherits="WebApplication1.newpop" %>





<title>jQuery Show Modal Popup from code behind or server side



$(function () {
$('#<%=btnclick.ClientID%>').click(function () {
$("#popupdiv").dialog({
title: "Apple",
width: 430,
height: 250,
modal: true,
buttons: {
close: function () {
$(this).dialog('close');
}
}
});

return false;
});
});
$(function () {
$('#<%=Button2.ClientID%>').click(function () {
$("#popupdiv1").dialog({

title: "ORANGE",
width: 430,
height: 250,
modal: true,
buttons: {
close: function ()
{

$(this).dialog('close');
}
}
});

return false;
});
});











<asp:gridview id="GV_popup" runat="server" cellpadding="4" forecolor="#333333" gridlines="None">
<alternatingrowstyle backcolor="White">
<footerstyle backcolor="#990000" font-bold="True" forecolor="White">
<headerstyle backcolor="#990000" font-bold="True" forecolor="White">
<pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center">
<rowstyle backcolor="#FFFBD6" forecolor="#333333">
<selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy">
<sortedascendingcellstyle backcolor="#FDF5AC">
<sortedascendingheaderstyle backcolor="#4D0000">
<sorteddescendingcellstyle backcolor="#FCF6C0">
<sorteddescendingheaderstyle backcolor="#820000">


<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:constr %>" selectcommand="SELECT [Descriptions] FROM [Fruits] where Itemid=1">






<asp:button id="btnclick" runat="server" text="APPLE" onclick="btnclick_Click" width="102px">





<asp:gridview id="GridView2" runat="server" cellpadding="4" forecolor="#333333" gridlines="None">
<alternatingrowstyle backcolor="White">
<footerstyle backcolor="#990000" font-bold="True" forecolor="White">
<headerstyle backcolor="#990000" font-bold="True" forecolor="White">
<pagerstyle backcolor="#FFCC66" forecolor="#333333" horizontalalign="Center">
<rowstyle backcolor="#FFFBD6" forecolor="#333333">
<selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="Navy">
Member 15900030 20-Jan-23 10:38am    
buttons: {
close: function () {
$(this).dialog('close');
}

I WANT TO CHANGE THE CLOSE TO COPY BUTTON

Member 15900030 20-Jan-23 10:43am    
PLEASE ANY ONE HELP TO ME IMPROVE MY CODE

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900