{"id":91,"date":"2008-09-18T11:03:52","date_gmt":"2008-09-18T15:03:52","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2008\/09\/18\/convert-text-to-upper-or-lower-case\/"},"modified":"2008-09-18T11:03:52","modified_gmt":"2008-09-18T15:03:52","slug":"convert-text-to-upper-or-lower-case","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2008\/09\/18\/convert-text-to-upper-or-lower-case\/","title":{"rendered":"Convert text to upper or lower case"},"content":{"rendered":"<p>To do so, simply make use of the <i>toUpperCase()<\/i> or <i>toLowerCase()<\/i> methods.  For example:<\/p>\n<pre class=\"code\"><xmp><input type=\"text\" name=\"myField\" id=\"myField\" size=\"20\" onKeyup=\"javascript:this.value=this.value.toUpperCase();\"> : To Upper\n\n<input type=\"text\" name=\"myField\" id=\"myField\" size=\"20\" onKeyup=\"javascript:this.value=this.value.toLowerCase();\"> : To Lower<\/xmp><\/pre>\n<p>Below is the working sample:<\/p>\n<pre class=\"code\"><input type=\"text\" name=\"myField\" id=\"myField\" size=\"20\" onKeyup=\"javascript:this.value=this.value.toUpperCase();\"> To Upper\n\n<input type=\"text\" name=\"myField\" id=\"myField\" size=\"20\" onKeyup=\"javascript:this.value=this.value.toLowerCase();\"> To Lower<\/pre>\n<p>If you do not wish to run it for each key-up such as in this example, try the <i>onChange<\/i> event, which will only fire when the user leaves the input field.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This note demonstrates a simple event handler to change text to upper or lower case using Javascript.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=91"}],"version-history":[{"count":0,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/91\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}