b u d d h a ha scritto:
i tried but not wrking
am placing a sample code which i used

 <script type="text/javascript">
  $(document).ready    (

             $('img').each(
                function()
                    {
                        $('img').attr({'src', "http://localhost/
s.demo/"+$(this).attr('src')});
                    });
                );
    </script>
Maybe I confused you.

You've mixed two types of syntax. You can achieve this with 2 syntax:

1.
$('img').each(function(){
$('img').attr({'src': "http://localhost/s.demo/"+$(this).attr('src')});
});

2.
$('img').each(function(){
$('img').attr('src',"http://localhost/s.demo/"+$(this).attr('src'));
});

In the case n.1 you are passing an object to the attr method using the json syntax : {'key':'value'} // better if you want to change several attributes in only one call. In the case n.2 you are passing 2 params to the attr method : key, value // it's ok in your case


--
gianiaz.net - web solutions
via angelo custode, 10 - 23100 sondrio (so) - italy
+39 347 7196482

Reply via email to