I didn't find an answer that satisfies me about this newbie javascript (using jQuery) question...
I have these 2 codes inside a document ready...
CODE 1
$('myElement').click(function(){
if(isMobile()){
//do something...
}
});
CODE 2
if(isMobile()){
$('myElement').click(function(){
// do somthing...
});
}
What is the correct approach and why?
Thanks guys
Aucun commentaire:
Enregistrer un commentaire