2017-04-05 39 views
1

我對標籤「contenteditable」有問題,只有在Firefox中。我希望用戶能夠修改他正在創建的調查的標題以及動態創建的問題的標題。它在IE和Chrome上運行良好,但在Firefox上我無法修改問題標題。Firefox內容使用innerHTML的可編輯問題

這裏是什麼樣子 對鉻:https://gyazo.com/f142c432fcd2994a5f254106d912ff11

,並在Firefox上:https://gyazo.com/5e454710231dc5c957dc46358cf92cf0

爲標題的代碼(這工作完全正常)的

<h3 id="surveyTitle" class="text_justify fi-page-edit" contenteditable="true">Survey title</h3> 

而爲生成的問題

var questionDiv = document.createElement("div"); 
    questionDiv.innerHTML = "<div class='large-12 columns mybold fi-page-edit' style='resize: none;' contenteditable='true' id='title"+questionNumber+"'>Question "+questionNumber+"</div> </br>"; 
    var container = document.getElementById("viewForm"); 
    container.appendChild(questionDiv); 
    container.appendChild(document.createElement("br")); 

也許是因爲「viewForm」是禁用的字段集:

<form> 
    <fieldset disabled="disabled" id="viewForm"> 
    </fieldset> 
</form> 

但由於它適用於其他瀏覽器,我實在看不出哪裏出了問題......

+0

你看到任何錯誤在螢火蟲 – ManiMuthuPandi

+0

@ManiMuthuPandi不,沒有錯誤,當我加載頁面時,當我點擊問題標題 – Raytho

回答

0

問題解決了,它實際上是因爲「禁用」標籤。 Firefox似乎是唯一不允許「禁用」div內的「contentEditable」的瀏覽器,因此我將其刪除,現在我將它添加到每個anwser輸入中,以便問題標題不再被禁用。 (我希望它很明顯,對不起,如果不是)