Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery select element inside a class

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 ?

like image 331
strike_noir Avatar asked Apr 20 '10 04:04

strike_noir


People also ask

How do I select a tag within a class in jQuery?

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.

How do I select an element in jQuery without an ID or class?

var noSpace= $('*:not([id])*:not([class])'); // 84 ?

How do I find the element inside a div?

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.

How do you select an element within an element?

The element element selector is used to select elements inside elements.


1 Answers

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') 
like image 178
awgy Avatar answered Oct 11 '22 12:10

awgy