English 中文(简体)
使用习俗属性是否有效?
原标题:Is using custom attributes valid?
  • 时间:2011-11-22 11:18:45
  •  标签:
  • jquery
  • html

我想取消任何联系,增加彼此的属性。 以下是我是如何做到这一点的。

function anularEnlaces(){
    $( nav a ).each(function(){
        var href = $(this).attr( href );
        var id = $(this).attr( id );
        $(this).attr( href , javascript:void(0) );
        $(this).attr( hrefnot ,href);
        $(this).attr( nivel , uno );
        $(this).attr( seccion , dos );
    });
}

我的问题是,增加习俗的有效/建议方式吗?

最佳回答
问题回答

页: 1


数据使用实例:

<a hred="some/url" data-custom="value">test</a>

// getter
var customValue = $( a ).data( custom );
var customUndefined = $( a ).data( testing );

如今的习俗 价值包含“价值”指示,未定义的习俗含有未界定的

// setter
$( a ).data( custom ,  test );
$( a ).data( testing , true);




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签