javascript - jQuery: return string as html - Stack Overflow

I have a "Label" control on my form which is being populated via jquery.My problem however,

I have a "Label" control on my form which is being populated via jquery. My problem however, is I need to return my string with html tags, but my label doesn't seem to recognize html. Here's my control:

<label id="ment"></label>

And here's how I'm working with it in javascript:

var ment;
ment = $("#ment");
ment.text("<b>Please scan an <br/>item!</b>");

In the above code, the html in my string is ignored. Is there any way I can get my form to recognize the returned html tags?

Thanks

I have a "Label" control on my form which is being populated via jquery. My problem however, is I need to return my string with html tags, but my label doesn't seem to recognize html. Here's my control:

<label id="ment"></label>

And here's how I'm working with it in javascript:

var ment;
ment = $("#ment");
ment.text("<b>Please scan an <br/>item!</b>");

In the above code, the html in my string is ignored. Is there any way I can get my form to recognize the returned html tags?

Thanks

Share Improve this question asked Sep 13, 2012 at 14:28 goalie35goalie35 7864 gold badges17 silver badges37 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 6

Use the html function :

ment.html("<b>Please scan an <br/>item!</b>");

try ment.html("<b>Please scan an <br/>item!</b>");

You could also use document.getElementById("ment").innerHTML = "<b>Please scan an <br/>item!</b>";

ment.html("<b>Please scan an <br/>item!</b>");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744252736a4565246.html

相关推荐

  • javascript - jQuery: return string as html - Stack Overflow

    I have a "Label" control on my form which is being populated via jquery.My problem however,

    8天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信