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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -