#Your Friendly Neighborhood-html

1 messages · Page 1 of 1 (latest)

idle turtle
#

👋 What specifically are you trying to do?

austere onyx
#

I'm trying to modify one id's content.

#
<p id="changeme"> this will be changed </p>
<script>
$("#clickme").click(function () {

    $header = $(this);
    $content = $header.next();
    $content.slideToggle(0, function () {
        //execute this after slideToggle is done
        //change text of header based on visibility of content div
        $header.text(function () {
            //change text based on condition
            return $content.is(":visible") ? '<span> opened </span>' : '<span> closed </span>';
        });
    });

});
</script>
#

But it's getting changed with a plain html code.

#

Instead of the actual <p> code.

idle turtle
#

I think you want something more like this: https://linuxhint.com/change-html-elements-using-javascript/

austere onyx
#

Yes, but I still get it plain html