Reputation: 5863
I have a django template with the form:
{% for user in users %}
<form class="myform">
<div class="title"></div>
Some form element
</form}
{% endfor %}
I'm getting the form in jQuery like:
var infoForm = $(this).next('myform');
to update the title
class, i do this:
infoForm.find('title').html('<div class='my-title'>My title</div>');
But it doesn't update the DOM,
What am i doing wrong ?
Upvotes: 0
Views: 103
Reputation: 3091
$('.myform').first().find('.title').text('My Title');
or
$('.myform').get(0).find('.title').text('My Title');
Upvotes: 0
Reputation: 265
Use
('.myform');
instead of
('myform');
and
('.title')
instead of
('title')
Upvotes: 2
Reputation: 9549
Instead of
infoForm.find('title').html('<div class='my-title'>My title</div>');
Does this work?
$('.title').addClass('my-title').removeClass('title');
Upvotes: 0