[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1244
  • Last Modified:

[JS] execCommand() output lowercase?

execCommand(some-command) returns HTML code which is uppercase. Is there a way to get lowercase HTML as output?
0
Tagor
Asked:
Tagor
  • 3
  • 3
  • 3
1 Solution
 
COBOLdinosaurCommented:
for anything that is going to return a string you can use a toLoweCase() method

str=execCommand(someCommand).toLowerCase();

or

if (str1.toLowerCase()=='body')



Cd&
0
 
TagorAuthor Commented:
test.document.execCommand(com).toLowerCase();

Unfortunately this doesn't work.
0
 
COBOLdinosaurCommented:
What is the command you are trying t execute, and what is the string that is suppossedt ob coming back from the function.

Cd&
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
BatalfCommented:
Is this an WYSIWYG HTML editor? Are you using execCommand() to format text bold, italic etc. ?

I don't think you can format execCommand() to output HTML in lowercase format. You probably have to lowercase the tags when you save the content(if it's an HTML editor). A regexp on your server should do the trick. If you explain a little bit more what and why you want it to be lowercase, maybe we can give you a more specific answer.

Batalf
0
 
TagorAuthor Commented:
That's exactly what I want, Batalf.

It returns for example "<STRONG>" instead of "<strong>".
0
 
BatalfCommented:
Why do you need it in lowercase format?

What serverside language are you using? You should probably convert it to lowercase on the server.

Batalf
0
 
TagorAuthor Commented:
I am using PHP. However that won't convert it to lowercase.
0
 
BatalfCommented:
Is it a problem having the tags in uppercase format in the editor and convert it to lowercase each time you save the data?

And are there any particular reasons why you need it to be lowercase?

Last question: Is this an ie only editor? I have worked with these editors for a few years now, and my experience is that IE converts the tags to uppercase no matter what you do in your coding. An example:

<div id="myContent">
<p>Tags are in lowercase format here</p>
</div>
<script type="text/javascript">
alert(document.getElementById('myContent').innerHTML);
</script>

As you can see, the tags in the alert message is in uppercase format.

Batalf
0
 
COBOLdinosaurCommented:
points to Batalf IMHO.

Cd&
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now