English 中文(简体)
在不显示的 jquery 中添加 space 标记
原标题:adding span tag in jquery not displaying

我试图通过点击来修改 中的文本。该代码在 IE 和 Firefox 中似乎效果良好,但在铬中不起作用 。

这是im使用的代码

 $( <span></span> , {
    text: icon,
    class:  WebFonts 
时 时).appendTo( #  + btn);

btn 是一个正通过客户点击功能传递的配方。 正如我所说, 这是在 IE 和 Firefox 中使用的。 这是 Webfont cs cs 类和铬将使得当我不尝试用 javacript 附加它的时候 。

@font-face {
    font-family:  WebSymbolsRegular ;
    src: url( /font/fonts/websymbols/websymbols-regular-webfont.eot );
    src: url( /font/fonts/websymbols/websymbols-regular-webfont.eot?#iefix ) format( embedded-opentype ),
         url( /font/fonts/websymbols/websymbols-regular-webfont.woff ) format( woff ),
         url( /font/fonts/websymbols/websymbols-regular-webfont.ttf ) format( truetype ),
         url( /font/fonts/websymbols/websymbols-regular-webfont.svg#WebSymbolsRegular ) format( svg );
    font-weight: normal;
    font-style: normal;
时 时

.WebFonts {font-family:WebSymbolsRegular时 时

greatful for some help thanks shannon

~~~~~~~~~~~~~ Here is what your asking for

function checkDisableButton(btn, parmText, icon) {
var mbtn=$( #  + btn)
mbtn.attr( disabled ,   );
mbtn.addClass("buttonPad buttonProcessing button");
mbtn.text(parmText + "   |   ")
$( <span></span> , {
    text: icon,
    class:  WebFonts 
时 时).appendTo( #  + btn);

时 时

这叫它,叫它它叫它,叫它它叫它,叫它叫它它,叫它叫它叫它,叫它叫它叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它叫它,叫它叫它,叫它叫它叫它,叫它叫它叫它叫它叫它,叫它叫它叫

 <asp:LinkButton ID="lbSave" runat="server" CssClass="ButtonPrimary button" Text="Save"
    OnClientClick="checkDisableButton(this.id,  PROCESSING ,  V );" />

这是当单击 asp:linkbutton 时在铬中显示的代号 。

<a onclick="checkDisableButton(this.id,  PROCESSING ,  V );" id="ctl00_ContentPlaceHolder1_lbSave" class="ButtonPrimary button buttonPad buttonProcessing" href="javascript:__doPostBack( ctl00$ContentPlaceHolder1$lbSave ,  )" disabled="disabled">PROCESSING   |   <span class="WebFonts">V</span></a>

您会注意到, 横跨类= "WebFonts" 在代码中

这是点击前的代码

<a onclick="checkDisableButton(this.id,  PROCESSING ,  V );" id="ctl00_ContentPlaceHolder1_lbSave" class="ButtonPrimary button" href="javascript:__doPostBack( ctl00$ContentPlaceHolder1$lbSave ,  )">Save</a>

So it appears that the span tag is getting put in.. it s just not displaying... what other info do you need to help troubleshoot?

~~~~~~~~~ Here is some more info.. if i use this instead of jquery... the webfonts shows up

  document.getElementById(btn).innerHTML = parmText +  <span class=buttonPad>|</span><span class=WebFonts>  + icon +  </span> ;
    document.getElementById(btn).className =  buttonProcessing button  ;

更多信息.... 不确定我还能到哪里去

最佳回答

我认为关键词是:

Here is the webfont css class and chrome will render that when i m not trying to attach it in javascript.

铬在装入字体时非常挑剔, 因为它可能是一项耗时的任务。 尝试在您的页面中添加一个隐藏的元素 :

<span style="visibility:hidden" class="WebFonts">V</span>

然后铬将知道在创建页面时装入字体, 当您动态地将其添加到链接时将准备就绪

问题回答

您的代码导致分析错误; 这应该更好 :

$( <span></span> , {
    text: icon,
     class :  WebFonts 
}).appendTo( #  + btn);

我在 class 周围添加了引号





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

热门标签