2
Let’s assume I have two links
<a href="#pessoa1">link1</a>
<a href="#pessoa2">link2</a>
The content shown will only refer to the link clicked and when you click on another link the content currently open will be closed
<div id="pessoa1"></div>
<div id="pessoa2"></div>
Code in jquery I tried to use [id ="person"] to pick up content by number but it doesn’t work, some hint?
<script>
$('a').click(function(e){
$('[id^="pessoa"]').show("slow");
e.preventDefault();
return false;
});
</script>
Cool, I just don’t understand one thing, does [id ='person'] work like this in css? Something else like closing open content when you click another?
– user4451
Yes, it works in CSS. It will hide the ids that start with "person".... I will change the answer to hide the other.
– Sam
To be more specific, you can do
div[id^='pessoa']
– Sam
@user4451 Updated answer. You can use the same selector in jQuery to hide the Divs.
– Sam
Gosh, that dough, thank you, I was almost getting it but only lacked a thing or other in the code hehehe!!!
– user4451
@user4451 Now this
return false;
no need. You can remove.– Sam
If the answer solved, be sure to mark . =] Thanks!
– Sam