-1

I am looking for a way to change the href of the code below:

<link rel="stylesheet" type="text/css" href="theme1.css">

For example from:

<link rel="stylesheet" type="text/css" href="theme1.css">

to:

<link rel="stylesheet" type="text/css" href="theme2.css">

This is currently not in the head of the page but in the body. And I only want to target a specific one.

How can I change it using jQuery?

Satch3000
  • 44,076
  • 86
  • 209
  • 342

1 Answers1

1

You can use attr or prop method like this:

$('link[href*="theme1.css"]').attr('href','theme2.css');
Bhojendra Rauniyar
  • 78,842
  • 31
  • 152
  • 211