How to change style attribut?

How to change style attribut?

Hi everybody,

Im trying to change a style attribut by jquery but can't get it work.

I have a list of images like that:

  1. <div id="bgstrecher" class="bgstrecher">
  2.       <ul>
  3.             <li class="landscapes bgs-current" style="display:list-item"><img src="path img 1" /></li>
  4.             <li class="landscapes" style="display:none"><img src="path img 2" /></li>
  5.             <li class="landscapes" style="display:none"><img src="path img 3" /></li> 
  6.             <li class="landscapes" style="display:none"><img src="path img 4" /></li> 
  7.       <ul>
  8. </div>

I created another list. When I click on one element I get the value (<a>value here</a>) which is the same as one of the link (link1, link 2, link 3, link 4 etc). And then I would like to change the style of the li who has the same path as the clicked element.


  1. <div id="pagination">
  2.       <a class="pagination">path img 1</a>
  3.       <a class="pagination">path img 2</a>
  4.       <a class="pagination">path img 3</a>
  5.       <a class="pagination">path img 4</a>
  6. </div>

My script:
  1. $('#pagination a').live("click", function(){
  2. linkvalue = $(this).text();
  3.    alert("link : " + linkvalue);
  4. $('#bgstretcher li img').each(function(index) {
  5. alert(index + ': ' + $(this).attr("src"));
  6.                          if ($(this).attr("src") == linkvalue ) { 
  7.       alert ("found");
  8.  }
  9. });
  10. });



Do you have any ideas how to make it work?


Regards