Here is my HTML code that is generated by PHP.
<p id="resp19" class="resp">
<img src="logos/RO.png"><br>
<b>CompanyRO</b>
<span class="fprice">XXXXXX</span>
<span class="f_row">
<input name="first_row" type="radio">AAAAAAAAAA</span><br>
<span class="buts"><input class="f_det" value="Details" onclick="ShowDetails(resp19)" type="button">
<input class="f_det" value="Share" type="button"></span>
<span style="display: none;" class="details_content">
Detalii
</span>
After this, I’m hidding this span $('.details_content').hide();.
I want that when I press the Details button, the span with details_content is shown, only for this <p>.
How can I do that ?
You need to pass string to function
onclick="ShowDetails(resp19)":Then in function
ShowDetailswrite:Also as you use jQuery better to attach
clickevents usingclick()method:Html:
JS:
Note that you using
<p>element that is for paragraphs and they are inline elements. Better usage will be<div>or other block elements.