squiblo Posted January 21, 2010 Share Posted January 21, 2010 go to... www.squiblo.com/test.php to understand my problem Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/ Share on other sites More sharing options...
The Little Guy Posted January 22, 2010 Share Posted January 22, 2010 this line: var text = document.getElementById("text"); should look like this: var text = document.getElementById("test"); You have a spelling error. Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-999787 Share on other sites More sharing options...
squiblo Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks little guy I did not notice that mistake but it still does not work, does anybody understand why? Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-999822 Share on other sites More sharing options...
squiblo Posted January 22, 2010 Author Share Posted January 22, 2010 any help please? Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-999977 Share on other sites More sharing options...
KevinM1 Posted January 22, 2010 Share Posted January 22, 2010 After some tests, it looks like innerHTML transforms the closing tag of the line break element from this: <br /> To this: <br> Automatically. So, if you're testing for the XHTML style element, the conditional will fail. Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-1000014 Share on other sites More sharing options...
squiblo Posted January 22, 2010 Author Share Posted January 22, 2010 i have tried using lots of different tags, and they all seem to work, so why is it that only <br /> does not work? Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-1000019 Share on other sites More sharing options...
KevinM1 Posted January 22, 2010 Share Posted January 22, 2010 i have tried using lots of different tags, and they all seem to work, so why is it that only <br /> does not work? Dunno. Must be one of those wonderful JavaScript quirks that bites people in the ass from time to time. Unless you have your heart set on using the <br /> version of the tag, I'd just use the old school <br> version. Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-1000021 Share on other sites More sharing options...
squiblo Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks nightslyr, you've saved me alot of time Quote Link to comment https://forums.phpfreaks.com/topic/189370-onclick-change-innerhtml-problem/#findComment-1000024 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.