如何在CodeIgniter中创建javascript链接

<a href="javascript:void(0);" class="selectedpagination"  onclick="changeuploader();">
    Try flash Uploader
</a>

If I write in anchor tag's first parameter javascript:void(0);, it will open link to controller/javascript:void(0)

Also, how do I give it the class name and onclick event?

Easy as that:

anchor('#', 'Try flash Uploader', array('class'=>'selectedpagination', 'onclick'=>'changeuploader();'));

Check this https://www.codeigniter.com/user_guide/helpers/url_helper.html

Please stop doing <a href="javascript:void(0);" ... >. It is an extremely bad practice. And so is attaching events in HTML.

Instead you should attach events in an external JS file. PHP framework has nothing to do with this.

Try this

<a href="javascript:void(0);" class="selectedpagination"  onclick="javascript:changeuploader();">
    Try flash Uploader
</a>
  1. onclick="return false();"

    $('.selectedpagination').click(function(){ //To click here });
  2. You can use button.

I didn't find another solution instead of: $("a").removeAttr("href");