Find An Inner Div Which Has A Particular Attribute And Remove

In this code, we will find an inner div which has a particular attribute and delete the same.

Using The Code

Consider following is my HTML

[html]
<div class="dragDiv">
<div id="dragDivInner">
<div myid="1" class="droppable" myval="I"></div>
<div myid="2" class="droppable"></div>
</div>
</div>
[/html]

And what if, I need to find out a div which has attribute value ‘myid’=2 dynamically?

[js]
$(".dragDiv div[myid=" + ui.item.attr(‘myid’) + "]").remove();
[/js]

Here ui.item.attr(‘myid’) is the attribute value I am getting dynamically.

Please see other code snippets here: Code-Snippets

Kindest Regards
Sibeesh Venu

Leave a Reply

Your email address will not be published. Required fields are marked *

Serverless 360