Link to home
Start Free TrialLog in
Avatar of dgrafx
dgrafxFlag for United States of America

asked on

how to grab and display an element with specified class

after a form is submitted I have a success function:

success: function(data) { ....

what i want to do is check to see if data contains a div with a specified class.
if yes then display that element and if no then continue on as normal.

thanks
Avatar of santhimurthyd
santhimurthyd
Flag of United States of America image

will help you to get the controls with specific css name
$(".classname")

Take a look into the sample

http://api.jquery.com/class-selector/
Avatar of dgrafx

ASKER

i've seen this link
i'm unable to find the correct syntax
that's why i asked the question
check this


$(".classname").each(function(index) {
    alert(index + ': ' + $(this).text());
});
Avatar of dgrafx

ASKER

so where are we inputting data (as in function(data)) ?
Yes,

For more info, you can get it here
http://api.jquery.com/each/
ASKER CERTIFIED SOLUTION
Avatar of dgrafx
dgrafx
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you have got your solution from the comments else by your own.
Avatar of dgrafx

ASKER

of course i derived the solution on my own and from googling.

it's not a problem but all you did was post a couple links that did not address the issue.

have a good one ...
Avatar of dgrafx

ASKER

solution is provided