S
S
Sergey2015-10-25 20:25:21
JavaScript
Sergey, 2015-10-25 20:25:21

How to insert an invalid piece of code using js?

In general, there is one template for a part of an inner page that is used by several other pages with different structures. And on one of the pages the layout is going. so that the layout does not go, you need to add a piece of code there. The code is like this:

</div></div><div class="col-xs-12 col-sm-9 col-md-10 col-lg-10 windows_plane">


The template engine is there and everything is generated depending on the data in the classes. I wouldn't want to debug it, it's a long time.
You cannot change the template, because use two pages. If I fix it here, he'll go to another one. I also cannot make a separate template for another page, because you need to debug their architecture, everything is self-written there too.

If I do it through .prepend(), then as a result I see:
<div class="col-xs-12 col-sm-9 col-md-10 col-lg-10 windows_plane"></div>


Those. it makes a valid one from an invalid code and substitutes it. It doesn't solve the problem.
Can this task be implemented somehow with crutches in js?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Blyshko, 2015-10-25
@butteff

Invalid code basically cannot exist on the rendered page. When you try to insert an invalid piece, it will in any case be corrected to the best of your ability by the browser itself, if the template engine / js does not correct it itself.
Presumably here the closing tag is affixed somewhere below automatically. Accordingly, it is required to pull out that part of the tree that wraps around this div and insert it into this very div.
Alternatively, you can go a simpler way and try using the document.write() construct - as far as I understand, it does not do validation.
Otherwise, the most correct way is to debug and fix it :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question