i'd add logic code along lines of:
var x = $('span').text() $('body').append(x) if (x == '▼') { $('body').append('yay!') } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <span>▼</span> however, can see above snippet, "yay!" isn't appended body. how can check if unicode character equals escape sequence?
you can use string.fromcharcode() create character using decimal number matches html entity you're using. or copy character string literal , compare directly. may clearer or not depending on situation.
var x = $('span').text() $('body').append(x) if (x == string.fromcharcode(9660)) { $('body').append('yay!') } if (x == "▼") { $('body').append('yay!') } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <span>▼</span>
Comments
Post a Comment