Solved

llop through characters in textbox

Posted on 2014-10-17
3
67 Views
Last Modified: 2014-12-09
I would like to be able to loop through characters in a textbox and index them, work out their position and when a new line is started (i.e. when the text reaches the edge of the text box and wraps or when the enter key is pressed.)
0
Comment
Question by:Al4ddin2
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40386582
test page : http://jsfiddle.net/gr9sywt0/1/
var str = document.getElementById("TexboxID").value;
for(var i=0;i<str.length;i++) {
   var character =str.charAt(i)
   alert( character  );
}

Open in new window


<input type="text" id="TexboxID" value="hello" />
0
 

Author Comment

by:Al4ddin2
ID: 40386757
Thanks, say the contents of the textbox has some script that inserts the contents of the textbox into these tags [div]{content to check is in here}[/div] how do I then remove these to do the indexing?
0
 

Author Comment

by:Al4ddin2
ID: 40386775
i.e. rich text formatting
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question