tags:

views:

51

answers:

1

Hi all; with below code i can select all a href's value then change them;

$("a").each(function(){
 if (this.hostname == location.hostname){
     var url = this.href;
     var qs = $.jqURL.get('qs');
     if(url.indexOf('qs=') == -1 && (qs!= undefined && qs!= '')){
        if (url.indexOf('?')>0){
            $(this).attr('href', url + '&qs='+ qs);

        }
        else
        {
            $(this).attr('href', url + '?qs='+ qs);

        }
    }
 }
})

i want to apply onclick attribute like above code too.

<div onclick="window.location.href='http://www.domain.com'" style="cursor:pointer">Test</div>

thank you very much all, already now...

Regards,
Kerbooo

A: 
attr_val = $("div").attr("onclick");

attr_val.split("=")[1];
nicholasklick