Adsense
Popular Posts
- Install APXS in Redhat Linux
- MySQL workbench -"Could not decrypt password cache"
- Transfer modules between sites
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- datatable order by nunmeric
- MySQL date created and date modified
- super(props) in React
- PHP, dump varailbes in a format way
- React: connect(mapStateToProps, mapDispatchToProps)
Wednesday, June 17, 2015
JavaScript, simple alert dialog callback
In java Script, when we create alert box and click OK, we hope some actions are performed.
The Modal dialog box, jquery dialog box and bootbox dialog box have similar features.
But the following codes are simplest:
for example, a table with a column with delete icon:
<tr class='template'><td class='delete' ><span class='btn glyphicon glyphicon-trash'></span></td></tr>
After clicking delete ico, this row is deleted after click ok in alert box:
$('td.delete').on('click', function(){
var answer = confirm("Are you sure to delete this row?");
if (answer)
$(this).parents('tr').remove();
});
Labels:
dialog
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment