2
嗨,我正在使用haml和coffescript來編寫我的代碼。如何在輸入文本框中選擇(突出顯示)文本
的代碼片段如下
//haml code for input box and value
%input.detail_text{value: "<%= 'http://dailymus.es/#!/' + answer.user.nickname + '/muses/' + answer._id %>"}
文字輸入的顯示(在模式)
如何修改我的當前coffescript代碼,這樣,當我使我的模式視圖,框中的文本將如上所示高亮顯示。
我試着用下面的代碼有沒有用事先
//code to render the modal view
render: ->
$(@el).html @template(@model.toJSON())
//this is where I attempt to select the input box via jQuery and selecting the text
$(@el).find('input.detail_text').focus().select()
@
感謝
尼斯碼。在AngularJS指令中使用它,它工作得很好。謝謝! – Hcabnettek 2013-11-15 19:03:22