Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
I want to add spell checker functionality in all my text fields of my project ... How can i do that .. plz suggest
Posted
Comments
Sergey Alexandrovich Kryukov 20-Oct-13 2:24am    
What do you mean "add"? Do you have a spellchecker already and just don't know how to express its functionality on the pages, do you?
I would not advise doing so. Most modern browsers provide spell check options. But yes, you can deliver spell checker as a part of your side and enable it for all your input controls, but what part would be your concern? If you already have a spellchecker, you need to give an information on it, if not, it hardly can be a matter of this Quick Questions & Answers forum.
—SA
ridoy 20-Oct-13 2:25am    
language? c#/vb?

You can use below mentioned jQuery plugin for that.Check that.

C#
(function() {

  // This code will only work with Twitter Bootstrap

  var toggle = (function() {

    var fields = $('input:text,textarea');
    var spellchecker = null;

    function showPopover() {
      $('.popover').hide().find('.popover-content').each(function(){
        if ($(this).find('a').length) {
          $(this).parents('.popover').show();
          return false;
        }
      });
    }

    function create() {

      spellchecker = new $.SpellChecker(fields, {
        lang: 'en',
        parser: 'text',
        webservice: {
          path: '../webservices/php/SpellChecker.php',
          driver: 'pspell'
        },
        suggestBox: {
          position: 'below'
        },
        incorrectWords: {
          position: function(container) {
            this.after(container);
          }
        }
      });

      spellchecker.on('check.success', function() {
        alert('There are no incorrectly spelt words.');
      });

      spellchecker.on('check.fail', function() {

        fields.each(function() {

          var field = $(this);

          if (field.data('popover')) {
            return;
          }

          field.popover({
            trigger: 'manual',
            placement: 'bottom',
            title: '<i class="icon-info-sign"></i> Spelling errors'
          })
          .popover('show')
          .data('popover')
          .$tip
          .find('.popover-content')
          .append(field.next());
        });

        showPopover();
      });

      spellchecker.on('replace.word', function(incorrectWords) {
        showPopover();
      });

      spellchecker.check();
    }

    function destroy() {
      spellchecker.destroy();
      spellchecker = null;
      fields.popover('destroy');
    }

    function toggle() {
      (!spellchecker) ? create() : destroy();
    }

    return toggle;
  })();

  // Check the spelling
  $("#check-spelling").click(toggle);
})();


For more info check this : spellchecker on multiple form fields

jQuery Spellchecker Home

I hope this will help to you.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900