<< Back to index << Back to article

jQuery with asp.net examples : Manipulation Sample


html manipulation:

Container Div

Click here to replace html of container div with input text

Code:
$('#containerDiv').html($('#txtHTML').val());

Click here to select html of container div

Code:
alert($('#containerDiv').html());

Append/Prepend element(s):

Container Div 2

Click here to append <div>Appended Div</div> in container div

Code:
$('#containerDiv2').append('<div>Appended Div</div>');

Click here to prepend <div>Prepended Div</div> in container div

Code:
$('#containerDiv2').prepend('<div>Prepended Div</div>');

Insert element(s) after/before an element:

Container Div 3

Click here to insert <div>New Div</div> after container div

Code:
$('#containerDiv3').after('<div>New Div</div>');

Click here to insert <div>New Div</div> before container div

Code:
$('#containerDiv3').before('<div>New Div</div>');

For more information:


<< Back to index << Back to article