DOMにボタンを動的に追加しています。各ボタンには、ポップオーバーがあります。ここに私のコードは次のとおりです。 - 私はポップオーバーボタン「50」をクリックすることClickMe
ボタンのIDを取得したいPopoverボタンのIDを取得する
<button class="pop-Add" id='button1'>Add</button>
var popOverSettings = {
placement: 'bottom',
container: 'body',
selector: '[rel="popover"]',
html:true,
content: "<button type='button' id='+50' class='btn btn-small pop_button'> + 50 </button>"
}
$('body').popover(popOverSettings);
$('.pop-Add').click(function() {
var id = Math.floor((Math.random() * 1000000) + 1);
button = "<button rel='popover' id='" + id + "'>Click me</button>"
$('body').append(button);
});
。どうすれば入手できますか?
これは私が現在やっている方法である: -
$(document).on('click', '.bid_value_buttons' , function(){
alert($(this).attr('id'))
}
を助け、このアプローチでの問題は何であるホープ? – Rajesh
それは私に '+ 50'というIDを与えます。私はむしろ 'Math.random'を使って生成した' ClickMe'ボタンの 'id'を望みます。 – PythonEnthusiast
問題ありません。この視点のガイダンスは? – PythonEnthusiast