admin管理员组文章数量:1327849
I have created a custom confirm dialog using alertifyjs and am trying to set the labels and title, however, I can't seem to achieve both at once. Please can someone help.
<html>
<head>
<script src=".1.1/jquery.min.js"></script>
<link rel="stylesheet" href="/[email protected]/build/css/alertify.min.css" />
<link rel="stylesheet" href="/[email protected]/build/css/themes/bootstrap.min.css" />
<script src="/[email protected]/build/alertify.min.js"></script>
</head>
<body>
<div style="display:none;">
<div id="dlgContent">
<p> Enter Value One </p>
<input class="ajs-input" id="inpOne" type="text" value="Input One Default Value" />
<p> Enter Value Two </p>
<input class="ajs-input" id="inpTwo" type="text" value="Input two default Value" />
</div>
</div>
<!-- the script -->
<script>
var dlgContentHTML = $('#dlgContent').html();
$('#dlgContent').html("");
alertify.confirm(dlgContentHTML).set('onok', function(closeevent, value) {
var inpOneVal = $('#inpOne').val();
var inpTwoVal = $('#inpTwo').val();
//updateListItems(inpOneVal,inpTwoVal);
if (inpOneVal == "test" && inpTwoVal == "test") {
alertify.success('Successful');
} else {
alertify.error('Wrong')
}
}).set({title:"Update"},{labels:{ok:'Forward', cancel: 'Backward'}});
</script>
</body>
</html>
I have created a custom confirm dialog using alertifyjs and am trying to set the labels and title, however, I can't seem to achieve both at once. Please can someone help.
<html>
<head>
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr/npm/[email protected]/build/css/alertify.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr/npm/[email protected]/build/css/themes/bootstrap.min.css" />
<script src="https://cdn.jsdelivr/npm/[email protected]/build/alertify.min.js"></script>
</head>
<body>
<div style="display:none;">
<div id="dlgContent">
<p> Enter Value One </p>
<input class="ajs-input" id="inpOne" type="text" value="Input One Default Value" />
<p> Enter Value Two </p>
<input class="ajs-input" id="inpTwo" type="text" value="Input two default Value" />
</div>
</div>
<!-- the script -->
<script>
var dlgContentHTML = $('#dlgContent').html();
$('#dlgContent').html("");
alertify.confirm(dlgContentHTML).set('onok', function(closeevent, value) {
var inpOneVal = $('#inpOne').val();
var inpTwoVal = $('#inpTwo').val();
//updateListItems(inpOneVal,inpTwoVal);
if (inpOneVal == "test" && inpTwoVal == "test") {
alertify.success('Successful');
} else {
alertify.error('Wrong')
}
}).set({title:"Update"},{labels:{ok:'Forward', cancel: 'Backward'}});
</script>
</body>
</html>
This is how I have attempted
...}).set({title:"Update"},{labels:{ok:'Forward', cancel: 'Backward'}});
Please can someone tell me how I can achieve this because I want to set custom title and title for the dialog box. I been on the documentation but wasn't able to achieve what I wanted.
Share asked Jul 8, 2018 at 15:11 JackieJackie 4571 gold badge10 silver badges20 bronze badges1 Answer
Reset to default 7Your syntax is wrong
Change
.set({title:"Update"},{labels:{ok:'Forward', cancel: 'Backward'}});
to
.set({title:"Update"}).set({labels:{ok:'Forward', cancel: 'Backward'}});
<html>
<head>
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr/npm/[email protected]/build/css/alertify.min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr/npm/[email protected]/build/css/themes/bootstrap.min.css" />
<script src="https://cdn.jsdelivr/npm/[email protected]/build/alertify.min.js"></script>
</head>
<body>
<div style="display:none;">
<div id="dlgContent">
<p> Enter Value One </p>
<input class="ajs-input" id="inpOne" type="text" value="Input One Default Value" />
<p> Enter Value Two </p>
<input class="ajs-input" id="inpTwo" type="text" value="Input two default Value" />
</div>
</div>
<!-- the script -->
<script>
var dlgContentHTML = $('#dlgContent').html();
$('#dlgContent').html("");
alertify.confirm(dlgContentHTML).set('onok', function(closeevent, value) {
var inpOneVal = $('#inpOne').val();
var inpTwoVal = $('#inpTwo').val();
//updateListItems(inpOneVal,inpTwoVal);
if (inpOneVal == "test" && inpTwoVal == "test") {
alertify.success('Successful');
} else {
alertify.error('Wrong')
}
}).set({title:"Update"}).set({labels:{ok:'Forward', cancel: 'Backward'}});
</script>
</body>
</html>
本文标签: javascriptSetting title and labels in alertifyjsStack Overflow
版权声明:本文标题:javascript - Setting title and labels in alertifyjs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742219921a2435262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论