簡體   English   中英

如何模擬輸入文本? Javascript/jQuery, vextab

[英]How can I simulate typing text? Javascript/jQuery, vextab

我正在使用一個名為 vextab 的 javascript package。 https://github.com/0xfe/vextab package 使在 javascript 中創建吉他譜變得容易。 參考這個jsfiddle: https://jsfiddle.net/hy8efjg4/

package 根據 div 屬性和內容加載選項卡 svg。 我希望能夠更改 div 的內容以呈現新的選項卡 svgs。 我怎樣才能做到這一點?

<div class="vextab-auto"
    width=680 scale=1.0 editor="true"
    editor-width=680 editor-height=330>
    options space=20
    tabstave notation=true key=A time=4/4

    notes :q =|: (5/2.5/3.7/4) :8 7-5h6/3 ^3^ 5h6-7/5 ^3^ :q 7V/4 |
    notes :8 t12p7/4 s5s3/4 :8 3s:16:5-7/5 :h p5/4
    text :w, |#segno, ,|, :hd, , #tr

    options space=25
</div>

# javascript

scratch_tab = "options space=40 font-size=14\n" +
                  "tabstave notation=true key=A\n" +
                  "notes :q (5/2.5/3.7/4) $A7#9$ 15h16/1 20/1"

$('.editor').val(scratch_tab);
$('.editor').keyup();

該 keyup 表明即使觸發 keyup 也無濟於事。

使用 API 來達到預期的結果(他們的原生 js package,不是瀏覽器——但它仍然可以在瀏覽器中工作)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM