javascript - explain strange jquery selector -
javascript - explain strange jquery selector -
i exercising @ http://jqexercise.droppages.com/#page_0016_ , after completing exercise "change h2 h3" checked out reply pressing "give up?" , saw this:
var target = $('#target'); target.html(target.html().replace(/h2/g,'h3'));
does has clue how .replace(/h2/g,'h3') "selector" works?
i did not find .replace() , maybe deprecated. when found .replacewith() did not find references selector looks reg ex escape character.
if can explain or point read grade full.
actually if right /h2/ regex expression. between // taken , replaced string after comma. g flag apply matching globally.
you can read on mdn
javascript jquery
Comments
Post a Comment