Currently, I have:
<html>
<div class="yes1"><span><img src="img"></span></div>
</html>
<script>
var x = "='yes1'"
var y = "='yes2'"
$('.yes1').click(function () {
$('.yes1').find(x).replaceWith(y)
});
<script>
And I can’t get the find and replaceWith to work. I believe I’m not assigning the variables correctly. Any helpe would be appreciated.
Thanks
Assuming you are trying to change the contents of div yes1 with div yes2, then to make it work you would need the dot in front of the yes1 and yes2 (to make it a class selector, like so):
Alternatively, if you’re trying to CHANGE the class, then your script needs to be altered:
CORRECTION:
(Thank you to the kind stackoverflow users who pointed out changes that needed to be made)