javascriptexpando

How to remove extended attribute "jquery123456" from element


I have one element "<a id="sample" jquery1234567="0">Testing</a>"

I want to remove the last attribute (jquery1234567) from the above tag. But the attribute "jquery1234567" will be generated dynamically.


Solution

  • try this

      $("#sample").removeAttr('jquery1234567');
                    (or)
      var id=1234567;
      $("#sample").removeAttr('jquery'+id);
    

    this is not help for you..Pls add some extra description with code...

    Hi friend this will help you

          lastAttrIndex=($("#sample")[0].attributes.length)-1;
          lastAttr=$("#sample")[0].attributes[lastAttrIndex].name;
          $("#sample").removeAttr(lastAttr);