jquery - Find element that has either class 1 or class 2 -


i'm trying find text inside element class either myclass1 or myclass2.

var mytext = $(this).find('.myclass1:first').text(); 

this works fine unsure if/how can check 1 of 2 classes (my element have 1 class out of these 2 mentioned).

thanks help!

if want first 1 found (but one) use

var mytext = $(this).find('.myclass1,.myclass2').eq(0).text(); 

if want first of each kind (two results) @ answer provided @jelbourn.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -