[英]How to make a dynamically created field/element required?
我的嘗試是:
-- new field id and name: fruit
var cellText = document.createElement('input');
cellText.type = 'text';
cellText.id = 'fruit';
cellText.name = 'fruit';
cellText.required = true;
cellText.message = "Please enter something for the newly created Fruit field";
已針對Windows的Firefox 19和Chrome 26進行了測試,但均無法正常工作。 正確的語法是什么?
非常感謝。
您可以嘗試cellText.required = "required";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.