Any framework that improves the programming language is welcome by me.
e.g. SugarJs has been programmed with this in mind: I love it!
And any framework that isolates programmer from the language must be avoided at all costs!
e.g. jQuery is a Texas chainsaw!
function frm1_onSubmit (_event)
{
console.log('frm1_onSubmit');
//do something
return false;//prevent event propagation
}
function btn1_onClick (_event)
{
console.log('btn1_onClick');
$('form#frm1').submit();
}
function btn2_onClick (_event)
{
console.log('btn2_onClick');
this.form.submit();//does not trigger 'frm1_onSubmit'
}
$(function(){
console.log('attaching events..');
var frm1 = $('form#frm1');
frm1.submit(frm1_onSubmit);//add event listener
frm1.find('button#btn1').click(btn1_onClick);
frm1.find('button#btn2').click(btn2_onClick);
});
You can check it on jsFiddle.
Beware, it is a dangerous (programming) world out there!
Categories: