2017-05-17 43 views
-2

我有AJAX調用生成html浮動輸入字段(ASP.NET MVC)

這裏是Ajax請求這個網站碼

var videoHTML = '<div style="width:100%;overflow-y: hidden;background:white;height:60%;border-bottom:solid;border-color: #A9A9A9;">' 
       + '<div style="float:left; width:50%;height:288px;border-right:solid;border-color: #A9A9A9;margin-bottom:10px;">' 
       + '<video style="width:100%;height:290px; object-fit: contain;padding-right: 15px;padding-left:15px;" controls>'; 
    videoHTML += '<source src="' + document.location.origin + "/uploads/" 
       + question2[i].Linkes + ".webm" + '" type="video/webm">'; 
    videoHTML += '</video>' 
       + '</div>' 
       + '<div style="float:right;width:48%;text-align:center;height:296px;padding-top:5px;">' 
       + '<div class="qustion-div-two" style="height:80%;margin-top:20px; background:white;" >' 
       + '<div id="comments" style="width: 100%; height: 70%;">' + '</div>' 
       + '<div id="write_field" style="width:100%;height:30%;font-size:15px;">' 
       +'<input type="text" required>' 
       + ' <span class="highlight">' 
       + '</span>' 
       + '<span class="bar">' 
       + '</span>' 
       + '</div>' 
       + '</div>' 
       + '</div>'; 

我在這個<input type="text" required>問題,有時底這一領域,有時在刷新頁面之後排在最前面。

問題可能在哪裏?

回答

0

我找到了解決方案

我需要包含在母公司的div div來寫這個position: relative;

所以我的代碼現在是

+ '<div id="write_field" style="width:100%;height:30%;font-size:15px;position: relative;">'