特定の属性値を持つ要素が div タグ内に存在するかどうかを確認する方法。
例えば、
<div id='testdiv'>
<a dir='hello' href='#' ></a>
</div>
<input type='button' id='btn' />
これが私のJqueryです。
$('#btn').click(function(){
if(/*Here I need the condition to check whether, `a` tag with attribute `dir` with value `hello` is present inside `div` */)
{
alert(present);
}
}
私はjQueryの初心者なので、親愛なる友人にアドバイスしてください。ありがとう。