O
O
Oleg Galimov2016-12-22 12:56:31
PHP
Oleg Galimov, 2016-12-22 12:56:31

Whether it is possible to take out on a class, url links in one file?

Good time of the day.
I have a question. Have a site in html5, it has a lot of pages and url links.
And the question is, how can the class, url of the link be put into one file?
To change links faster.
Where should I look for php or jquery?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yevgeniy Kisselyov, 2016-12-22
@olegalimov

If I understood correctly from the example above, then yes it is possible through jquery, only the selector must be set correctly.
For the example above it would be:
Put it in a separate .js file included after jquery.
And wrap in:

$(function(){
$(".link_1").attr("href", "http://www.facebook.com/");
});

urls are replaced only after the page is fully loaded

A
Alexander, 2016-12-22
@lebonnet

make a site on cms, it will generate all the url itself

O
Oleg Galimov, 2016-12-22
@olegalimov

Let's say many html5 pages have code
whether it is possible on a class, url of the link to take out in one file?

$(".link[href]").attr("href", "http://www.facebook.com/");

M
Mosapi, 2016-12-22
@Mosapi

Excuse me, a newbie, but I'm more of an adherent of storing url'y in the database.
If you have so many urls on the page and they are constantly changing, I don’t think that it will be convenient for you to get into the page code every time, or even if you put it in a separate js.
And you can pull out with the usual php selection
. Well, if the site is on your host, and if not? ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question