Replace Div with attribute, insert Razor section
weedkiller opened this issue · comments
weedkiller commented
Hi, this is great!!
can you please share a sample on can we find div with attributes? and replace the tags with a section - while keeping the same text or html - content on the inside.
find this <div class=print> <div class=machine >print stuff only </div></div>
insert this with same old content -> @section print { <div class=@machine > print stuff only </div> }
- query and replace
DIV's containing Class="Print Media"
- and then replace with Razor section like
@section print {}
thanks
Florian Rappl commented
- Use the standard
QuerySelectorAll
(for help on this consult any guide for web development) and the replaceChild method. - I am not sure I get your question. Razor is something different. Do you want to introduce strings here, print the serialized code and save this as a cshtml file?