Click here to Skip to main content
14,299,986 members
Rate this:
Please Sign up or sign in to vote.
See more:
<div id="ListInvite" style="width: 255px; height: 100px; overflow: scroll; border: 1px solid black;">
   <asp:TextBox ID="getemail" runat="server" Width="255px" ></asp:TextBox>
   <asp:CheckBoxList ID="chkBxToInvite" runat="server"></asp:CheckBoxList>
</div>



From the above code, I've a div tag. Using CheckboxList I can add new checked list items into div.
If I enter email id in textbox and press enter, it should add into div content and shuld send mail automatically using the mail id's listed in div tag.

additional conten copied from comment below
I should able to type text(email) in textbox and when pressed enter key, it should add in div content and also shuld automatically send emails to those mail id's listed in div content
Posted
Updated 16-Oct-13 1:30am
v2
Comments
Kornfeld Eliyahu Peter 16-Oct-13 7:05am
   
And what the question is?
Sriram Ramachandran 16-Oct-13 7:11am
   
I should able to type text(email) in textbox and when pressed enter key, it should add in div content and also shuld automatically send emails to those mail id's listed in div content
Rajeev Jayaram 16-Oct-13 7:22am
   
What did you try till now? Did you face any specific issue?
Sriram Ramachandran 16-Oct-13 7:51am
   
actually I doesn't knew to do that part .... need some codings
Sriram Ramachandran 16-Oct-13 8:21am
   
Or atleast --- When I type something in textbox, I should be able to get the value of the textbox when enter key is pressed

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <input id="idEmail" type="email" /><input id="idAdd" type="button" value="add" onclick="addEmail(); return false;" />
    <br />
    invite list...
    <div id="idList">

    </div>

    <script type="text/javascript">
        function addEmail()
        {
            if (idEmail.value != null && idEmail.value != '')
            {
                var checkbox = document.createElement("input");
                var description = document.createTextNode(idEmail.value);

                checkbox.type = "checkbox";
                checkbox.name = "idChk" + idList.children.length;
                checkbox.value = idEmail.value;
                checkbox.checked = true;

                window.open('mailto:' + idEmail.value);

                idList.appendChild(checkbox);
                idList.appendChild(description);
                idList.appendChild(document.createElement("br"));
            }
        }
    </script>
</body>
</html>


You have to know that no email can be send from JavaScript. The provided code will open the default email client for the client...
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100