1.11M Members

Clicking on <a> tag

 
0
 

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

 
0
 

Just use same class name for all a tag which have myId.N

 
0
 

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

 
0
 

simple , try this

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

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

});
Question Answered as of 6 Months Ago by M.Waqas Aslam and Mallika_P
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: