我已经复习过了
How can I change the text inside my <span> with jQuery?
我正在动态创建包含标签的按钮。
$("<button type='button' id='" + this.patExeId
+ "' name='exerciseMachine' class='btn exeBtn btn-large col-lg-2 col-md-2 col-sm-2 col-3 m-1 p-3' "
+ "value='" + this.exeName + "'>" + this.exeName + " <span class='label label-light label-as-badge'>0</span></button>").appendTo($("#allExercises"));
三个“this.patExeId”值是
我想在练习集完成后更新标签。单击此代码时触发的测试按钮:
$('#'+$(this).attr('id')+ ' span').html('3');
这会触发控制台日志中显示的错误:
jquery.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #OA== span