Thoughts of mine

I write some of my Ideas, Issues I faced in the development and writing skill improvement articles about my personal activities.

Java Script for get the Capitalized First characters.

No comments



Very Very Simple steps for capitalise your string in jQuery....

$('#text_field').blur(function() {


   var abbreviation = this.value.match(/[A-Z]/g).toString().replace(/,/g,"");

   var abbreviationField = document.getElementById('institute_abbreviation');\\

   abbreviationField.value = abbreviation;


});


In here "#text_field" text_field is text_field id with id identifier # symbol

          the blur event is sent to an element when it loses focus. Originally, this event was only applicable to form elements, such as <input>. In recent browsers, the domain of the event has been extended to include all element types. An element can lose focus via keyboard commands, such as the Tab key, or by mouse clicks elsewhere on the page.

in side the blur function 1. abbreviation variable get the string like ABC from the "Above Befor Call" string

this.value.match(/[A-Z]/g).toString().replace(/,/g,"");

"this" means current element of the html page.



No comments :

Post a Comment