SOLVED

use mktoBoolean in if statement

Go to solution
Anonymous
Not applicable

Re: use mktoBoolean in if statement

it is constantly being updated

you can see the latest try now

Grégoire_Miche2
Level 10

Re: use mktoBoolean in if statement

Hi Jonas,

it becomes a JS issue there: The debugger says:

"Uncaught TypeError: Cannot read property 'style' of null" on the line

Use a simple quote:

document.getElementById('main-content-id').style.width = "100% !important";

-Greg

Anonymous
Not applicable

Re: use mktoBoolean in if statement

did not work...

using this code now:

<script>

    if ('${show_sidebar}' == 'none') {

          document.getElementById('main-content-id').style.width = "100% !important";

        } else {}

</script>

Anonymous
Not applicable

Re: use mktoBoolean in if statement

which debugger do you use?

Grégoire_Miche2
Level 10

Re: use mktoBoolean in if statement

Chrome's

Grégoire_Miche2
Level 10

Re: use mktoBoolean in if statement

OK, i found out. The code is correct but the script is before the diplay of the element.

Move the script at the end of the page, before the </body>

-Greg

Anonymous
Not applicable

Re: use mktoBoolean in if statement

sorry to say it's not working either

Anonymous
Not applicable

Re: use mktoBoolean in if statement

the error code disappeared though...

Grégoire_Miche2
Level 10

Re: use mktoBoolean in if statement

HI Jonas,

This linked to your page and the global html error might be the reason why it does not work. I tried to run a similar code on another page, and it worked fine.

XMLHttpRequest cannot load http://www.postnord.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://pages.postnord.com' is therefore not allowed access.

-Greg

Anonymous
Not applicable

Re: use mktoBoolean in if statement

thanks, it sound strange that that error would only affect that bit of code but if that is the only thing left to try it is the logical solution.. I will check it out! thank you!