jQuery की जगह के साथ () विधि
❮ jQuery के एचटीएमएल/सीएसएस तरीके
उदाहरण
पहले <p> तत्व को नए टेक्स्ट से बदलें:
$("button").click(function(){
$("p:first").replaceWith("Hello world!");
});
परिभाषा और उपयोग
रिप्लेसविथ () विधि चयनित तत्वों को नई सामग्री से बदल देती है।
वाक्य - विन्यास
$(selector).replaceWith(content,function(index))
Parameter | Description |
---|---|
content | Required. Specifies the content to insert (can contain HTML tags)
Possible values:
|
function(index) | Optional. Specifies a function that returns the content to replace
|
इसे स्वयं आज़माएं - उदाहरण
चयनित तत्वों को नई सामग्री से बदलने के लिए फ़ंक्शन का उपयोग कैसे करें।
❮ jQuery के एचटीएमएल/सीएसएस तरीके