jquery - Cant remove parent element of an element -


my structure is:

<p>         <span>             <input type="text" class="key" value="21">         </span>         <span>                <input type="text" class="value" value="55">          </span>         <span>                 <a href="#" class="updateaction" data-setting-id="1">update</a>             <a href="#" class="deleteaction" data-setting-id="1">delete</a>         </span>     </p> 

i try remove parent element whenever delete link clicked:

 $(this).parent().parent().hide();  $(this).closest('p').hide(); 

close input tags , call preventdefault , work.

http://jsfiddle.net/p3tew/

$(document).on("click", ".deleteaction", function (e) {     e.preventdefault();     $(this).closest('p').hide(); }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -