Navigation

Home
Search
Submit A Resource
Contact Us
About Functionn

Subscription Options


Subscribe By Email (265+)


Lists


Archives

Dec 24, 2012

Author: Hirvesh Posted At: 12/24/2012 Tags: , , , ,

Cursores.js - A JavaScript Library To Get And Replace Tokens Under The Cursor

Share:

Cursores.js (cur·so·res) is a JavaScript library from Bitbucket which allows you to get the word on which the cursor is current within, and replace it if you wish.  Cursores.js works in textareas, inputs or plain strings.

Cursores.js uses regex to match the characters before and after the cursor.  It also allows you to specify the ‘search window’ which is the number of characters before and after the cursor you want to match for the word within which the cursor is.

A simple example usage of Cursores.js would be as follows. Consider that you have the following text in a textarea:  “Functionn – Open Source Web Reso|urces To Keep Developers Functionn.in’” where the pipe (|) is the position of the cursor in the textbox.

Cursores.js would return the word token current under the cursor as being ‘Resource’.  You could then use the replace method of Cursores.js to replace the word with something else.


Browser Support

Cursores.js supports all modern browsers which implements the methods selectionStart and setSelectionRange() , including IE9.

Requirements: None
Demo: http://cursores.bitbucket.org/
License: Apache License v2.0

Daily Posts, Be Updated, Subscribe:

Want Free Web Resources? Enter Your Email And We'll Send It To You - Daily! (265+ Subscribers)

Yup, it's that straight forward! Enter your email address below and we'll send you the latest web resources to your inbox, everyday. We don't do spam. Ever.

Trending Posts On Functionn This Week

Share:

Other Interesting Resources:

0 comments:

Post a Comment

 


Recent Posts

Popular Categories



Popular Components



Popular Licenses