The way you're doing this looks very unnatural by having the script tag in the middle of your content. What exactly are you trying to achieve? Just adding text?
It would be better if you did something like this: <p>111111<span id="lufi">Csere()</span>222222</p> $(function() { $("#lufi").text('Duma'); }); And if you wanted to add the text to more than one place, consider using a CLASS instead of ID (which has to be unique on the page). On Aug 11, 3:14 am, Lay András <laysoftjqu...@gmail.com> wrote: > Hello! > > I used this little code to replace some content with jquery: > > <script type="text/javascript"> > function Csere() { > $('#lufi').replaceWith('Duma');} > > </script> > > <p>111111<script type="text/javascript" id="lufi">Csere()</script>222222</p> > > This works fine, but i'd like to eliminate the id attribute from > script tag. I tried $(this).replaceWith('Duma'), and > $(this).parent().replaceWith('Duma'), but neither works. How can I > solve this? > > Lay