Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by Eidos_IT
at 2024-11-30 17:58:00
Point:500 Replies:6 POST_ID:828855USER_ID:11767
Topic:
WordPress;JavaScript;Hypertext Markup Language (HTML)
I have a php page with JavaScript to be used on a wordpress page,but when the page is generated all <div> <p> etc. appends new lines. Example :
Test.php ->
<script type="text/javascript">
alert('hello<div>world</div>');
</script>
When I view-source there is new lines on each html-tags : <div><p> - which breaks the JavaScript syntax
I tried to remove filter wpautop on content, but no go :(
Thanks
Test.php ->
<script type="text/javascript">
alert('hello<div>world</div>');
</script>
When I view-source there is new lines on each html-tags : <div><p> - which breaks the JavaScript syntax
I tried to remove filter wpautop on content, but no go :(
Thanks
Attachment:php-newlines.PNG
Expert: duncanb7 replied at 2024-12-01 14:53:01
Thanks for your pt
Hava a nice day
Duncan
Hava a nice day
Duncan
Author: Eidos_IT replied at 2024-12-01 14:41:21
Duncan this is clearly in the right direction - THX
Accepted Solution
Expert: duncanb7 replied at 2024-12-01 02:31:00
500 points EXCELLENT
take a look at this , and just try it on link-1 replace img tag by your tag or * in preg_replace for similar issue as yours
link-1 http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/
linke-2 take a look if have time
http://sww.co.nz/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
Hope it will give your some hint
Duncan
link-1 http://css-tricks.com/snippets/wordpress/remove-paragraph-tags-from-around-images/
linke-2 take a look if have time
http://sww.co.nz/solution-to-wordpress-adding-br-and-p-tags-around-shortcodes/
Hope it will give your some hint
Duncan
Author: Eidos_IT replied at 2024-12-01 00:01:52
The issue is not the code it self, the alert stuff is just an example and not relevant.
The reason is that I am using a plugin for wordpress that just dont work, so I found out that the javascript is broken due to the line breaks and <p>.
I can't see this as an editor issue, the line break is happening in the middle of a string, and I am using clean nano on linux.
This is clearly a wordpress issue/feature, because if I run the page as a normal php page on apache2 there is no issues.
The reason is that I am using a plugin for wordpress that just dont work, so I found out that the javascript is broken due to the line breaks and <p>.
I can't see this as an editor issue, the line break is happening in the middle of a string, and I am using clean nano on linux.
This is clearly a wordpress issue/feature, because if I run the page as a normal php page on apache2 there is no issues.
Expert: goubun replied at 2024-11-30 23:17:30
I think that the problem is because you are inserting the code in visual editor mode and you have to insert that only in text mode, You can change the mode of the editor in the right-top tab in the entry editor.
Expert: eemit replied at 2024-11-30 19:25:23
You should use Element.html like this:
<div id="my-pageid">
<div id="id-to-insert-html">
</div>
- - -
<script>
var el = document.getElementById('id-to-insert-html');
el.html = '<div><p>hello world</p></div>';
</script>
<div id="my-pageid">
<div id="id-to-insert-html">
</div>
- - -
<script>
var el = document.getElementById('id-to-insert-html');
el.html = '<div><p>hello world</p></div>';
</script>