-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
  • 47,356
  • 86
  • 216
  • 346

1 Answers1

1

You can use attr or prop method like this:

$('link[href*="theme1.css"]').attr('href','theme2.css');
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231