jQuery है () विधि
उदाहरण
अगर <p> का पैरेंट <div> एलिमेंट है, तो कुछ टेक्स्ट को अलर्ट करें:
if ($("p").parent().is("div")) {
alert("Parent of p is div");
}
परिभाषा और उपयोग
है () विधि जांचती है कि क्या चयनित तत्वों में से एक चयनकर्ता एलीमेंट से मेल खाता है ।
वाक्य - विन्यास
$(selector).is(selectorElement,function(index,element))
Parameter | Description |
---|---|
selectorElement | Required. Specifies a selector expression, element or a jQuery object to match the current set of elements against. Returns true if there is at least one match from the given argument, and false if not. |
function(index,element) |
Optional. Specifies a function to run for the group of selected elements.
|