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
- <div class="dragDiv">
- <div id="dragDivInner">
- <div myid="1" class="droppable" myval="I"></div>
- <div myid="2" class="droppable"></div>
- </div>
- </div>
And what if, I need to find out a div which has attribute value ‘myid’=2 dynamically?
- $(".dragDiv div[myid=" + ui.item.attr('myid') + "]").remove();
Here ui.item.attr(‘myid’) is the attribute value I am getting dynamically.
Please see other code snippets here: Code-Snippets.