Start New Discussion within our Web Development Community

Hello guys,
I am writing a Greasmonkey script and I need little help here. So I have this code:

$(document).ready (get);

function get ()
{
                var elems =$( "a[id*='myId.']" );
                                    if (elems.length>0) {
                                     $("a[id*='myId.']").trigger("click");
                                    }
                       }

the point is that there are a lot of a tags with id myId.N where N is different number. But that click just doesn't work. Any ideas?

Regards,
Fr3aK

But I want the a tags to be clicked and the trigger doesnt work. This is the problem. I think...

simple , try this

$('a').click(function(){
    var id = jQuery(this).attr("id");
    //now you have id of clicked tag.

    alert($('#' + id).length());

});
This question has already been answered. Start a new discussion instead.