Price Range
ボタンをクリックすると、ポップオーバーが開きます。そのポップオーバーには、2つの入力ボックスがあります。 Min Rent
ボックスとMax Rent
ボックスです。そのボックスに値を入力すると、Price Range
ボックスに以前に入力された値が表示されるようにしたいと思います。 $2000 to $2500
のようなものです。私は見て、Googleと他のStackOverflowの質問と回答を見て、しかし、私はこれを達成する方法がわかりません。どんな助けでも大歓迎です!テキスト入力のボタンテキストを変更する - JS、RoR
エルブファイル:
<div class="col-md-2 col-xs-6">
<a tabindex="0" class="button btn-transparent" id="listing-price-selector" role="button" data-toggle="popover">Price Range <span class="caret"></span></a>
</div>
<div id="listing-price-content" style="display: none;">
<div class="container-fluid">
<div class="row">
<div class="col-xs-6">
<div class="input-group input-group-sm">
<span class="input-group-addon" id="basic-addon1">$</span>
<%= f.text_field :min_price, class: "form-control", placeholder: "Min Rent", data: { "binding-name" => "min-price" } %>
</div>
</div>
<div class="col-xs-6">
<div class="input-group input-group-sm">
<span class="input-group-addon" id="basic-addon1">$</span>
<%= f.text_field :max_price, class: "form-control", placeholder: "Max Rent", data: { "binding-name" => "max-price" } %>
</div>
</div>
</div>
</div>
</div>
JSファイル:
$('#listing-price-selector').popover({
html: true,
trigger: 'manual',
placement: 'bottom',
template: '<div class="popover price-range-pop" role="tooltip"><div class="arrow"></div><div class="popover-content"></div></div>',
content: function() {
return $('#listing-price-content').html();
}
});