Railsアプリにフォームがあり、リンクの入力の1つで選択した値を使用したいと思います。どうすればこれを達成できますか?ありがとう
<%t= f.text_field :studen_id, placeholder: 'Type Here ', class: 'form-control load_assets' %>
<% link_to 'Show Details', .... %>
.
.
.
}).on('typeahead:selected typeahead:autocompleted',
#code that sets the value of link
});
# view
<% link_to 'Show details', '#', class: 'dynamic-link' %>
# javascript
.on('typeahead:selected typeahead:autocompleted', function() {
url = $(this).val() // assuming this is the vaule of the input
$('.dynamic-link').attr('href', url) // set required data
});
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加