dimanche 17 juillet 2016
Using jQuery's unwrap() to remove a class
I want to remove the class of emphasis from all tags that have that class in a specific cell of the table. I'm selecting the table cell content like this:
var answer = $('tr.problem_display_work:last td:first').html();
In another place in the code, I'm using unwrap() like this:
$(".emphasis").contents().unwrap();
However, I'm not sure how to combine the two. I tried this, but it failed:
var answer = $('tr.problem_display_work:last td:first').html().(".emphasis").contents().unwrap();
Any ideas?
EDIT FOR CLARIFICATION: I want to keep the HTML inside the tag. So, if I have: 14 + 6 = <span class="emphasis">20</span> I want to end up with 14 + 6 = 20.
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire