0

Hello Daniweb,

I am trying to implement a show/hide feature for a website, to help organise the content more effectively. At the moment I am using a simple JS function that changes the .style.display of a div to either none or block.

The problem is that because the content is pulled in via PHP, the DIV needs to change it's ID to reflect this, when I attempt to do this I receive an unterminated string literal error.

This is the relevant part of my code:

document.getElementById('<?php echo ($Links[$Val]); ?>').style.display = 'block';

When I view this section in the console, it appears as the following (note the line break, which I believe is causing the error).

    document.getElementById('ABC123
    ').style.display = 'block';

Is there anyway I can prevent this happening?

Thank you

1
Contributor
1
Reply
12
Views
4 Years
Discussion Span
Last Post by Octet
1

Clearing my cache seems to have resolved the issue, probably the new JS wasn't being loaded.

Thread closed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.