×Welcome aboard! We are happy you are here and wish you good net-raft!



Together We Can Simplify The World

the current number of solutions:  2304
 (1x)    .htaccess (1x)    AJAX (13x)    ANGULARJS (157x)    ASP (1x)    ASP.NET (4x)    BACKBONE.JS (47x)    BOOTSTRAP (12x)    C# (216x)    COFFEESCRIPT (28x)    CSS (71x)    HTML (47x)    JADE (32x)    JAVA (51x)    JAVASCRIPT (426x)    JQUERY (377x)    JQUERY MOBILE (5x)    JSON (5x)    LARAVEL (23x)    MYSQL (9x)    NODEJS (155x)    ORACLE SQL (19x)    PERL (1x)    PHP (293x)    PYTHON (9x)    REACT (61x)    RUBY (23x)    RUBY ON RAILS (1x)    SHELL (1x)    SQL (90x)    SQL SERVER (3x)    TYPESCRIPT (50x)    VB.NET (26x)    W3.CSS (6x)    W3.JS (40x)    
join us

click to create your account

add text focusing by pointer jquery

(jquery add text focusing pointer)

- JQUERY

 viewed 21

Comment:
JQUERY

0

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.3.min.js " type="text/javascript"></script>
</head>
<body>

<textarea id="textarea" rows="10" cols="20">focus the pointer before or behind text and click button</textarea></br>

<button id="addurl">addurl</button>

<script type="text/javascript">

$(document).ready(function(){

$("#addurl").click(function () {

var x = location.href;

var $txt = $("#textarea");
var caretPos = $txt[0].selectionStart;
var textAreaTxt = $txt.val();
var txtToAdd = x;
$txt.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos) );

});

});

</script>

</body>
</html>

     

created: 2 months ago

The power of the user (%)

43%

Do you know a little more effective code ? Feel free to optimize ...


haven't you found what you're looking for ?
Write us your question ...
Login is not needed.


The most helpful JQUERY solutions
Likes Solution Technology
653 plugin get client ip address using jqueryJQUERY
347 plugin detect country jqueryJQUERY
266 cookie jqueryJQUERY
222 plugin convert thousands to K jqueryJQUERY
208 How to detect the version of IE browser using jquery ?JQUERY
Check out all of JQUERY ...
The most viewed JQUERY solutions by country
Solution Country
How to get client machine name or computer name with jquery?Cinque Terre
How to get client machine name or computer name with jquery?Cinque Terre
How to get client machine name or computer name with jquery?Cinque Terre
cookie jqueryCinque Terre
How to get client machine name or computer name with jquery?Cinque Terre