[英]I want to add the placeholder attribute to the input within this DIV but it does not have a unique property that I could locate it with
我無法直接編輯HTML,因為Squarespace不允許這樣做,只能使用JS和Jquery。
$("#field city :input").attr('placeholder', 'City');
我嘗試使用此功能,但不起作用
<div class="field city">
<label class="caption"><input class="field-element field-control" name="" x-autocompletetype="" type="text" spellcheck="false" data title="">
</label>
</div>
提前致謝
檢查這個js小提琴 ..
<div class="field city">
<label class="caption"><input class="field-element field-control" name="" x-autocompletetype="" type="text" spellcheck="false" data title="">
</label>
</div>
<script>
document.getElementsByClassName('field-element')[0].placeholder='city'
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.