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).

    ').style.display = 'block';

Is there anyway I can prevent this happening?

Thank you

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

Thread closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.