English 中文(简体)
每项职能的适用
原标题:Appending html with each function

这是我在此提出的第一个问题。

我希望有人能够就此提出一些看法。

法典:

$(json.error).each(function(i, item){
    $( #returned ).append( <span class=error>&nbsp; +item+ &nbsp;<span><br /> );
});

因此,我所试图做的是,用我的处理稿回来的错误,使一部分人满为患。

采用这种方式的问题是,独立实体不承认这一类别并适用我的束缚。 我也在审判中

$(json.error).each(function(i, item){
    $( #returned ).html( <span class=error>&nbsp; +item+ &nbsp;<span><br /> );
});

然而,我相信,......它只是显示返回的json阵列中的最后错误。

我仍然很新,难以编码,也无法确保以适当的方法完成我想要做的工作。

最佳回答

我会错过,但我认为,你们所需要的是围绕错误类别进行的双重引用。

$(json.error).each(function(i, item){
    $( #returned ).append( <span class="error">&nbsp; +item+ &nbsp;<span><br /> );
});
问题回答

对<代码>addClass发出单独呼吁的第一项做法 类似方法:

$(json.error).each(function(i, item){
    $( #returned ).append( <span>&nbsp; +item+ &nbsp;<span><br /> ).addClass( error );
});




相关问题
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!

热门标签