Hello everyone. I need help.
There is such code:
<div><span></span><a href="">Клик</a></div>
How to make the click on the link change the contents of the span , which is in the parent?
КликHow to make the click ...">
Hello everyone. I need help.
There is such code:
<div><span></span><a href="">Клик</a></div>
How to make the click on the link change the contents of the span , which is in the parent?
A rough example:
<div id="tadam"> <span></span> <a href="javascript://">Клик</a> </div> <script> $('#tadam a').click(function(){ $('#tadam a').prev('span').html('тест'); }); </script>
For a diva or for a reference, the class or id set is no difference. Create a .click event handler and select the span element that lies before the link using the prev () method.
Source: https://ru.stackoverflow.com/questions/361316/
All Articles