I am new to jquery. I am using the Notyfy jQuery plugin. I want to show the notification bar with the message on specific condition. want to show the success and error message on specific condition
I want to do something like this. please correct my code so I can successfully implement this library
var notyfy-success = notyfy({text: 'successfully deleted'});
var notyfy-error = notyfy({text: 'somethings wrong'});
$(document).ready(function(){
if (true){
alert("hello");
notyfy-success.show('success bar ');
}else{
notyfy-error.show('error bar ');
}
});
If you use TRUE in if() condition the else script never be performed. (buy i think u know that). However... I see the Documentation of the plugin and you not need to instantiate
notyfy-success
andnotyfy-error
define them only (TAKE CARE the character-
inside a variable name is not a good idea, use_
), and then inside "if" statement instantiates them:Now, on document ready the notyfy_success notification will show, if you set
_delete
tofalse
notyfy_error will show instead notyfy_success.http://jsfiddle.net/Frogmouth/43C7Q/
OMG... my english is terrible... I'm so sorry. I hope you can understand.. my bad.