下記のように、HTMLタグの id を末尾インクリメントして動的に振るような場合でよくやるTips。
<input type='text' id='inputbox-1' />
<input type='text' id='inputbox-2' />
<input type='text' id='inputbox-3' />
...
$("input").click(function(){
console.log($(this).attr('id'));
});
'inputbox-1'のように取得できるので、そこから文字列末尾を採取。
その値を他のHTMLタグに紐付けて使用します。
var text = $(this).attr('id');
var suffix = text.substr( text.length -2, text.length );
$('#myModal'+ suffix).modal('show');