Good day! Tell me, please, using jquery automatically when loading a page, replace the line <div id='name'> with <span> . I will explain. The engine automatically generates all content in <div id='name'> . And my page consists of several sections with their own blocks with id , which are wrapped in this common system <div id='name'> , and as a result - a lot of things on the page do not work. Thanks for the tip!


The block has the following styles: position:static and display:inline

  • one
    Not understood. What prevents your blocks from wrapping in the div id = "name", could you explain? You can replace it, but it will be a cruel crutch and you want to understand your problem first. - Ivan Pshenitsyn
  • one
    I can say for sure that the reason is not that the blocks are inside #name. Indirectly - possible. But you need to decide somewhere else, and not by replacing the unit. For example, you can have styles for elements inside #name. In this case, removing #name is the wrong approach, because it is enough to fix the styles. A huge amount of options. To understand - you need to see with your own eyes, or at least see a sample code. - Ivan Pshenitsyn
  • one
    And figure it out more specifically: what do "blocks are invisible" mean? Are they in the page code or not? If there is - see which styles make them invisible and find the answer. - Ivan Pshenitsyn
  • one
    Also make sure that you have one #name block on the page. - Ivan Pshenitsyn
  • one
    Give a link to this page or at least a sample of the code and I am sure that you will be prompted by the right solution. - Russian Bear

1 answer 1

What would run immediately after loading the script.

  (function(){ $('div#name').replaceWith('<span></span>'); })(); 
  • DmitriyKhirniy, at the same time the page becomes completely inaccessible, just a white sheet - LADYX
  • Try this code, which replaces the insert in ready function from jQuery - DmitriyKhirniy
  • DmitriyKhirniy, no change - LADYX