Answer the question
In order to leave comments, you need to log in
How to add one jquery handler to two django ModelForm fields?
Handler:
$(document).ready(function() {
$('#id_repeat_password').on('keyup', function(){
var Value = $('#id_repeat_password').val();
var Value1 = $('#id_password').val();
if (Value != Value1)
{
$("#text").animate({opacity: "1"}, "fast");
}
else
{
$("#text").animate({opacity: "0"}, "fast");
}
});
});
class SignUp(forms.Form):
username = CharField(label='username', max_length=150,
widget=TextInput(attrs={'required': True, "class": 'input', 'type': "text"}))
email = CharField(label='Username', max_length=150,
widget=TextInput(attrs={'required': True, "class": 'input', 'type': "text"}))
password = CharField(label='Password', max_length=150,
widget=TextInput(attrs={'required': True, "class": 'input', 'type': "password"}))
repeat_password = CharField(label='Repeat your password', max_length=150,
widget=TextInput(attrs={'required': True, "class": 'input', 'type': "password"}))
Answer the question
In order to leave comments, you need to log in
$('[type="password"]')
// Или дать класс этим полям
$('.inputPassword')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question