কন্টেইন্ডস্ সিলেক্টর(Contains Selector):জে-কোয়েরী -(পর্ব-১৩)


কন্টেইন্ডস্ সিলেক্টর(Contains Selector) attribute এর value এর মধ্যে নির্দিষ্ট কোন word কে খোঁজ করে, যদি পায় তবে ঐ attribute টিকে select করে। এ ক্ষেত্রে নির্দিষ্ট word টি attribute value এর প্রথম, মাঝে এবং শেষে(substring) যেকোন অবস্থানে হতে পারে।

Contains selector Syntax : $(‘[A*=”B”]’)

Description :

ঐ সকল element কে select কর যাদের A attribute এর value এর মধ্যে ‘B’ অছে।

Example :

$(‘a[href*=yahoo.com]’) – এটি anchor(<a></a>) element এ যাদের href attribute এর value ‘yahoo.com’ তাদের সকলকে select করবে।

উদাহরন Code :

[sourcecode language=”html”]
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<input name="man-news" />

<input name="milkman" />
<input name="letterman2" />
<input name="newmilk" />
<script>$(‘input[name*="man"]’).val(‘has man in it!’);</script>

</body>
</html>
[/sourcecode]

ফলাফল(output):

Selector Example

………………………………………………………………………………
আজ এখানেই শেষ করলাম। “HAVE A GOOD PROGRAMMING”

জে-কোয়েরী ধারাবাহিক টিউটোরিয়ালঃ

Leave a Comment