jQuery: How to innerHTML an HTML tag without id?

Posted by marknt15 on Stack Overflow See other posts from Stack Overflow or by marknt15
Published on 2010-05-28T06:17:58Z Indexed on 2010/05/28 6:21 UTC
Read the original article Hit count: 181

Filed under:
|

Hi,

For example I have this HTML code:

<div id="canvas">
    <div id="root">
        <div id="content">
            <span>
                <title>My SVG Example Title</title>
                <ellipse id="svg_1" />
            </span>
        </div>
    </div>
</div>

How can I innerHTML the <span> tag without changing the <title> tag using jQuery? So my expected output would be something like this:

<div id="canvas">
    <div id="root">
        <div id="content">
            <span>
                <title>My SVG Example Title</title>
                <input type="text" value="this is the innerHTML I must insert but how?" />
            </span>
        </div>
    </div>
</div>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery