Confirm Alert Before Deleting or Similar Action
1 2 3 4 5 6 7 8 9 |
function removeProgram(){ if(confirm('are you sure you want to delete program?')){ //do whatever here } } //---OR---// <a href="delete/123" onclick="return confirm('are you sure?')">delete</a> |
Check If Variable is Undefined Or Has No Value
1 2 3 4 |
//To check if variable "data" contains any value or not. if(data !== null && data !== undefined){ //Do whatever here } |
1 2 3 4 5 6 |
//you can write following code in document.ready function $('#id_of_input').keypress(function (e) { if(e.which ==13){ //13 is numeric value of enter key form.submit(); } }); |
Hit Enter Inside Input Field And Submit Form