我希望在匹配class
的输入元素之后插入span元素,并在checkbox
的输入类型之后插入一个span元素,以便为复选框元素设置样式。
我只能为类选择器实现它 例如: input元素如下所示:
<input data-attrname="artist" class="layered_attrs" id="57" type="checkbox">
我希望在此之后添加元素
<span class="checkmark"></span>
我可以使用以下方式实现这一目标:
$( "<span class='checkmark'></span>" ).insertAfter( ".layered_attrs" );
但我还要验证类型为layered_attrs
的输入ID类型,类型为checkbox
答案 0 :(得分:1)
可以使用:checkbox
选择器:
`Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x10de071e0>
Traceback (most recent call last):
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/andrew/projects/drfmonoengine/django-rest-framework-mongoengine-example/project/project/urls.py", line 5, in <module>
from app.views import UNDocumentViewSet, index_view, BlogViewSet
File "/Users/andrew/projects/drfmonoengine/django-rest-framework-mongoengine-example/project/app/views.py", line 7, in <module>
from rest_framework_elasticsearch import es_views, es_client, es_pagination, es_filters
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/rest_framework_elasticsearch/es_views.py", line 6, in <module>
from .es_mixins import ListElasticMixin
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/rest_framework_elasticsearch/es_mixins.py", line 9, in <module>
from .es_inspector import EsAutoSchema
File "/Users/andrew/projects/drfmonoengine/venv/lib/python3.6/site-packages/rest_framework_elasticsearch/es_inspector.py", line 1, in <module>
from rest_framework.schemas import AutoSchema
**ModuleNotFoundError: No module named 'rest_framework.schemas**'`
$( "<span class='checkmark'></span>" ).insertAfter( ".layered_attrs:checkbox" );