Solved

JQuery - loop through a string and select a character in a word

Posted on 2013-12-10
2
615 Views
Last Modified: 2013-12-10
I need to loop through every character in a string in Jquery. Is this right?

Any ideas
var var_string;
var_string = "excellent";

for(var char in var_string)
{

alert(char);


}
0
Comment
Question by:GlobaLevel
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
Comment Utility
use charAt : http://jsfiddle.net/8ernN/

var var_string;
var_string = "excellent";

for(var i=0;i<var_string.length;i++)
{

alert( var_string.charAt(i) );


}

Open in new window

0
 
LVL 10

Author Closing Comment

by:GlobaLevel
Comment Utility
excellent
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now