w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
how can i have a text field which have text in it and when the user clicks on the text field the text inside the field vanishes

You should use attrs parameter for form field widget like this:

from django.forms import TextInput


class CategoriesForm(ModelForm):
    class Meta:
        model = Categories
        widgets = {
            'category_name': TextInput(attrs={'placeholder': 'PLACEHOLDER
TEXT HERE'})
        }

Here is documentation





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.