First, question goes in general. What are the main pros and cons of using either JS approach:
<a href="go.php" onclick="alert('Go!')">go</a>
or jQuery way:
More writing in second approach – of course – but this is pure code, while using Yii this is simplified and code length is comparable.
So, I’m not asking about answers in style of “less/more coding”, but some standards, good practices etc. When using jQuery approach is better?
And in particular… Let’s say that I bind delete button’s click event using jQuery way. And inside click’s code there’ll be confirmation dialog returning false (preventing click) if user cancels deletion. Then, what happens if jQuery for some reasons fail to load? Will user be able to invoke delete action without seeing confirmation? That would be a disaster. If this is true wouldn’t JS approach with onclick just a safer way here?