Hello everyone, I ask for help, here is the script:

var article = { delete: function (id) { $.post('?action=admin', { act: 'delete', aid: id }, function (a) { alert(a); }) }, edit: { now: function (id) {.......... }, withadmin: function (id) { window.location = '?action=admin&act=article_edit&id=' + id; } } } 

The <script></script> works, but if I write onclick="article.edit.now('1');" nothing works, why?

If I write this:

 <script> $('#edit_news').click(function () { article.edit.now('1'); }); </script> 

Works if I write

 <a href="" onlick='article.edit.now('1')'>Редактировать</a> 

Does not work.

  • Write the code - when it works and when it does not work - timka_s

1 answer 1

Write like this:

 <a href="#" onclick="article.edit.now('1');">Редактировать</a> 

And it will probably work

  • And not LICK , but CLICK : D onLick is more appropriate to apply to other "объектам" ! ))) - DemoS
  • @DemoS, really, did not notice)) - timka_s