Skip Navigation Links



jQuery Replace Strings

Author : Virendra Dugar      Blog :jQuery By Example      Date: 7/9/2012 8:58:00 AM


Below is simple jQuery code snippets to replace all the dots (.) present on HTML page and then replace it with hyphen.

$(document).ready(function() {
    var strNewString = $('body').html().replace(/\./g,'-');
    $('body').html(strNewString);
});
Remember: Replace functions returns a string which contains the updated text. So you need to first assign into a variable and then re-assign it.

Instead of, (.) or "-", text can be anything. All you need is to make change in the replace function arguments and you are good to go.
See live Demo and Code.
Feel free to contact me for any help related to jQuery, I will gladly help you.

Bloggers

active bloggers in the last 24 hrs. Number shown in the bracket represents number of posts published in past 24 hrs,


other authors(123)

AMJAD KHAN(5)

deponti(3)

Gowdhaman Rajakrishnan(3)

Ambica Srimal(2)

Ankit Gupta(2)

BUTTERFLIES OF TIME(2)

churumuri(2)

DIGITALASIAN(2)

Fire Crystals(2)

Harimohan(2)

Naga(2)

Rani Acharyulu(2)

Ranjith(2)

ravi dabas(2)

.(1)

“आशु”(1)

Abhishek K. Mishra(1)

Ajay Shah(1)

Anand(1)

Anand VijayaKumar(1)

Ananda Rajashekar(1)

Anita Jeyan Sandeep(1)

ankush samant(1)

Artnavy(1)

ashwin35007(1)

Ashwini Kumar(1)

Aurindam Mukherjee(1)

Beyond(1)

Bijoy Momaya(1)

Carpe Diem!(1)

churumuri(1)

cochinblogger(1)

Cynical(1)

Debolina Raja Gupta(1)

Debolina Raja Gupta(1)

delhizen(1)

eM(1)

Fidarose Isha(1)

Firoze Shakir Photographerno1(1)

Gayu(1)

Govind Kumar(1)

Hari Chandana P(1)

Hemant Sonawanes Studio(1)

Ibrahim(1)

Indrani(1)

Iti(1)

Izaj Ahmed Shaikh(1)

Jahn n Style(1)

Jaya(1)

jayanpsk(1)

Jhoomur Bose(1)

Jishnu Saji(1)

Jnanaswarupan ji(1)

jquerybyexample(1)

Kalyani(1)

Krishna Rao(1)

KUNJUBI VARGHESE(1)

Lluvia....(1)

Madhavi Madhurakavi(1)

Maliny(1)

Manreet Sodhi Someshwar(1)

Megha Sarin(1)

mêlée(1)

Minu CP(1)

Miss Frangipani(1)

Monu Awalla(1)

Mosarrap H Khan(1)

Mythreyi(1)

Nanka(1)

Nevil.C.Philip(1)

Nidz(1)

Nik P(1)

P.(1)

palak sharma(1)

parth joshi(1)

Payal forever(1)

Prahallad Panda(1)

pratish(1)

Preeti Aghalayam aka kbpm(1)

Preety(1)

Pushkaraj Shirke(1)

R.D. Bhalekar(1)

Raksha(1)

Renu(1)

Ritesh Agarwal(1)

RNA Corp(1)

sahiljshah21(1)

sangeeta(1)

SEO(1)

Shazia M(1)

Shiva(1)

Shobha(1)

Shruthi(1)

sidhu352(1)

Simran(1)

smile khan(1)

Srivalli(1)

Sue(1)

Sugumar Je(1)

suraj savardekar(1)

Swapna(1)

Swaram(1)

Tapo(1)

Tarang Sinha(1)

The Parenting Forum(1)

Thommy(1)

TummyKhush(1)

vandysnape(1)

verbivorehere(1)

Vikram Karve(1)


garland of Languages of India
an amalgamation of the diversified traditions
gracefully presented with novelty
http://www.haaram.com