2016-04-09 20 views
2

dropzone jsでボタンを削除するスタイルを設定します。私はちょうどそれがグリフィス付きのブートストラップボタンのように見えるようにしたい。要素内に新しい要素を作成する

代わりにこの

<a class="dz-remove btn btn-default" href="javascript:undefined;" data-dz-remove="">Remove file</a> 

のような結果にこの

Dropzone.prototype.defaultOptions = { 
    dictRemoveFile: "Remove file", 
     if (this.options.addRemoveLinks) { 
      file._removeLink = Dropzone.createElement("<a class=\"dz-remove btn btn-default\" href=\"javascript:undefined;\" data-dz-remove>" + this.options.dictRemoveFile + "</a>"); 
      var custom = Dropzone.createElement("<div class=\"custom\"></div>"); 
      custom.appendChild(file._removeLink); 
      file.previewElement.appendChild(custom); 
     } 

のようなデフォルトのドロップゾーンのコードのように私はこの

<div class="custom"> 
<button type="button" class="dz-remove btn btn-default" href="javascript:undefined;" data-dz-remove aria-label="Left Align"> 
    <span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> 
</button> 
</div> 

のような結果をしたいので、私はドロップゾーンにコードを追加.js like this

左のボタン内

<div class="custom"> 
    <button type="button" class="dz-remove btn btn-default" href="javascript:undefined;" data-dz-remove aria-label="Left Align"> 
    </button> 
</div> 

問題のみタグスパンを作るために、今、私は唯一の成功(それは表示されませんでした)のため

答えて

0
file._removeLink = Dropzone.createElement("<button type=\"button\" class=\"dz-remove btn btn-default\" href=\"javascript:undefined;\" data-dz-remove aria-label=\"Left Align\">" + this.options.dictRemoveFile + "</button>"); 
var custom = Dropzone.createElement("<div class=\"custom-btn\"></div>"); 
var span = Dropzone.createElement("<span class=\"glyphicon glyphicon-align-left\" aria-hidden=\"true\"></span>"); 
file._removeLink.appendChild(span); 
custom.appendChild(file._removeLink); 
file.previewElement.appendChild(custom); 

上記のコードをお試しください。すべきこと

関連する問題