jQuery परिशिष्ट () विधि :
❮ jQuery के एचटीएमएल/सीएसएस तरीके
उदाहरण
प्रत्येक <p> तत्व के अंत में एक <span> तत्व डालें:
$("button").click(function(){
$("<span>Hello World!</span>").appendTo("p");
});
परिभाषा और उपयोग
appendTo () विधि चयनित तत्वों के अंत में HTML तत्वों को सम्मिलित करती है।
युक्ति: चयनित तत्वों की शुरुआत में HTML तत्व सम्मिलित करने के लिए, prependTo() विधि का उपयोग करें।
वाक्य - विन्यास
$(content).appendTo(selector)
Parameter | Description |
---|---|
content | Required. Specifies the content to insert (must contain HTML tags). Note: If content is an existing element, it will be moved from its current position, and inserted at the end of the selected elements. |
selector | Required. Specifies on which elements to append the content to |
इसे स्वयं आज़माएं - उदाहरण
प्रत्येक चयनित तत्व के अंत में एक मौजूदा तत्व सम्मिलित करने के लिए appendTo () विधि का उपयोग कैसे करें।
❮ jQuery के एचटीएमएल/सीएसएस तरीके