1

var standard = $(function(){

                        //should return reversed iterated standard anchor array
                            $.each(standard_anchor,function(value){ return (value) })  

                            });

/////

$(function(){

    /*  should  replace all a href values with reversed iterated standard anchor data   */
         $('a [href]').reverse().each().attr('href', function(){ return ( standard) });


});

/////

so that's what I tried but it didn't work, and I don't know why it didn't work, any suggestions?

standard_anchor is the array name, and var standard is a function I thought could return those array values when used in a function.

2
  • 1
    I formatted your code example. Next time, please format your code properly yourself, as it might help to get more attention to your problem by others. Commented Aug 10, 2011 at 15:42
  • FYI: document.links can be used in place of your query. Commented Aug 10, 2011 at 16:07

2 Answers 2

2

I think what you're looking for is:

$('a [href]').reverse().each(function(i){
    $(this).attr('href', standard_anchor[i]);
});
Sign up to request clarification or add additional context in comments.

1 Comment

thanks so much however it didn't work here's a copy of the whole js maybe you'll see what went wrong
0

var standard was not defined properly, it was enclosed in a jquery method, try this.

var standard = function(){

   //should return reversed iterated standard anchor array
   $.each(standard_anchor,function(value){ return value });  

};

(function(){

   /*  should  replace all a href values with reversed iterated standard anchor data   */
   $('a[href]').reverse().each().attr('href', function(){ return standard(); });


});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.