Adsense
Popular Posts
- MySQL workbench -"Could not decrypt password cache"
- mod_auth_cas.so error: undefined symbol: SSL_connect
- JavaScript, remove trailing insignificant zeros after toFixed function
- Set Windows path command line
- JavaScript Arrays and Associate Arrays
- Design date and signature box in Latex
- Install APXS in Redhat Linux
- super(props) in React
- jQuery, toggle the display
- PHP function for input sanitizing
Showing posts with label dialog. Show all posts
Showing posts with label dialog. Show all posts
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();
});
Subscribe to:
Posts (Atom)