#Your Friendly Neighborhood-html
1 messages · Page 1 of 1 (latest)
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.
I think you want something more like this: https://linuxhint.com/change-html-elements-using-javascript/
The innerHTML HTML DOM property is utilized for changing the content of the HTML Elements in JavaScript. It can also be used to write the dynamic HTML on the HTML document, such as links, comment forms, and registration forms. This write-up discussed the procedure for changing the HTML elements using JavaScript. Moreover, examples related to the...
Yes, but I still get it plain html