Jumble words Game, alert if correct

I was looking into this code of jumble word game, it checks each alphabet if correct & locks it. I basically want to lock it only if the whole word is correct. Can suggest please?

Fiddle : http://jsfiddle.net/nvw24/

On Stop dragging :

stop: function () {
      var textValue = name.split(" ");
         $(".ui-sortable").each(function (sortIndex, sortDiv) {
           $(sortDiv).find("label").each(function (index, elem) {
              if (textValue[sortIndex][index] == $.trim($(elem).text())) {
                 $(elem).removeClass("ls").addClass("correctText");
               } else {
                  $(elem).removeClass("correctText").addClass("ls");
               }
           });
      });

 }

Answers


Use this snippet to identify the correctness,

var total =$(this).find('label');
if(total.length === total.filter('.correctText').length){
    alert('correct');
}
DEMO

Need Your Help

stack execution protection and randomization on ubuntu

c security stack-overflow buffer-overflow

As part of a course assignment i need to write an exploit code to cause a buffer overflow and execute code that is present on stack.

How to make Chrome DevTools reload only selected resource?

javascript extjs google-chrome-devtools

Is there a way to force reloading only specific resource-files from DevTools?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.