Click here to Skip to main content
15,886,012 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I added the User Name and Email Id in a text box using following function.

function (result) {
                    var rv = [];
                    $.each(result, function (i, v) {

                        rv.push(v.Name +" ("  + v.Email + " )" );
                    });


And it shows in Textbox like:
HTML
<b>ABC(ABC@XYZ)</b>


My textbox:

XML
<input type="text" id="txtEvent" name="txtEvent" class="form-control" placeholder="User" />


Now i want to access this Name and email Id differently.
How can i do it?
Thanks in advance.
Posted
Updated 18-Aug-14 23:14pm
v4
Comments
ChauhanAjay 19-Aug-14 3:28am    
Do you want to access the text box from your server side or javascript
Karthik Harve 19-Aug-14 5:07am    
did you mean , the textbox will hold text like "abc(abc@abc.com)" So, you want to separate name and email from this text ?

1 solution

1. Split the textbox value at '(' and store it in a string array

2. then trim the second string in array at ')'

you will get the name and email seperately by this way
 
Share this answer
 

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