I want to fetch url links from textbox in asp.net application
I have textarea when I entered text if it contains links like www.google.com or http://google.com then I want get every links or first link from textarea value.
How I achieve with Jquery or Javascript language.
I want to get each or first links when I typing words/text into textarea control.
here, I writes some code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Page </title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="innerWrap">
<textarea autocomplete="off" id="txtUpdate" style="height: 48px; width: 408px;" >
</textarea>
</div>
</div>
<script>
$(document).ready(function(){
$('#txtUpdate').keyup(function() {
getURLfromText(jQuery.trim($(this).val()));
});
});
function getURLfromText(objTxt)
{
// code
}
</script>
</form>
</body>
</html>
Please give me correct solution for that, also should be works I copied and paste some text. How It possible.?
Edited
Input
Down to Earth: Tracy Caldwell Dyson www.google.com
After spending nearly six months in space,
she is back on the ground, with two expeditions
under her belt. http://bit.ly/dEpNHo
OutPut
Array linkarray[]=new Array();
linkarray[0]="www.google.com";
linkarray[1]="http://bit.ly/dEpNHo";