Answers for "put place holder in forms field"

0

placeholder in input field MVC

@Html.TextBoxFor(m => m.UserName, new { @class = "form-control",@placeholder = "Name"  })
Posted by: Guest on January-27-2021
0

placeholder in model form

class LoginForm(forms.Form):
    username = forms.CharField(label='username')
    password = forms.CharField(label='password')


    def __init__(self, *args, **kwargs):
        super(LoginForm, self).__init__(*args, **kwargs)
        self.fields['username'].widget.attrs['placeholder'] = 'username'
        self.fields['password '].widget.attrs['placeholder'] = 'password'
Posted by: Guest on June-19-2021

Browse Popular Code Answers by Language