I have this function:(我有这个功能:)
$(function() {
$('#toggle-event').change(function() {
if($(this).prop('checked') == true){
$('.textfield, .editable_textfield').toggleClass('textfield editable_textfield');
$('.textfield, .editable_textfield').editable('option', 'disabled', false);
$('.editable_selectfield_1').editable({
source: [
{value: 'ja', text: 'Ja'},
{value: 'nee', text: 'Nee'},
],
});
$('.editable_selectfield_1').editable('option', 'disabled', false);
}
else
{
$('.textfield, .editable_textfield').editable('option', 'disabled', true);
$('.editable_selectfield_1').editable('option', 'disabled', true);
}
});
})
This function can be triggerd by:(此功能可以通过以下方式触发:)
<input id="toggle-event" type="checkbox" data-toggle="toggle" data-size="mini" data-on="<span class='glyphicon glyphicon-pencil'></span>" data-off="<span class='glyphicon glyphicon-pencil'></span>" data-onstyle="danger">
But now I want this button to be shown an multiple places on the same page.(但是现在我希望此按钮在同一页面上显示多个位置。) The ID needs to be uniqye to be able run the script, how to achieve this?(ID需要是唯一的才能运行脚本,如何实现呢?)
ask by Muiter translate from so