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