[Answered ]-Not able to add html tags through jQuery in django

0👍

If it was working on a normal html page probably my guess is your jquery library is not loaded when you are serving your html page via django.
Try using this instead and see if your page is working or not.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

2👍

Your selector is wrong, if you want to select an element with ID you should use ID selector: $('#div1') or class selector $('.div1'). Currently you are trying to select an element that it’s tag name is div1.

$(document).ready(function(){ // when DOM is ready
     $("#div1").append("<h3>First</h3>");
     // $(".div1").append("<h3>First</h3>")
})
👤Ram

Leave a comment