I want to select an anchor inside a div like this
<div class="response content"> Disapproved Bank Mandiri<br><br> <p> <a class="showlist" href="#">Back to list?</a> </p> </div>
What is the jquery to do this ?
In jQuery, the class and ID selectors are the same as in CSS. If you want to select elements with a certain class, use a dot ( . ) and the class name. If you want to select elements with a certain ID, use the hash symbol ( # ) and the ID name.
var noSpace= $('*:not([id])*:not([class])'); // 84 ?
We can see that by selecting a div using getElementById() and then selecting all its elements inside the div using querySelectorAll(), we can apply changes to all its elements.
The element element selector is used to select elements inside elements.
Any anchor in a div with "response" and "content" classes:
$('.response.content a')
Or only anchors with a class of "showlist":
$('.response.content a.showlist')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With