Récupérer l'URL d'un lien avec jQuery

Mars 2013

L'URL cible d'un lien hypertexte est contenue dans son attribut href. Cet attribut est très facile à récupérer en jQuery, à l'aide de la fonction .attr comme ceci :

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
	<script>
	jQuery(function($){
		alert( $('#lien1').attr('href') );
	});
	</script>
</head>
<body>
	<a id="lien1" href="http://www.google.fr/">Lien</a>
</body>
</html>

Modifier l'URL cible d'un lien

La méthode attr peut aussi servir à modifier la valeur de l'attribut href pour changer l'URL pointée par un lien <a>. Pour cela, il suffit de passer la nouvelle URL en second paramètre :

Dans un tout autre contexte, cet article est très intéressant : afficher/masquer l'onglet développeur dans excel.

$('#lien1').attr('href', 'http://www.finalclap.com/')

Fini de lire cette page ? allez faire un tour ici : tutoriel texte métallique / industriel, ça peut vous intéresser.

1 commentaire :
commentaire n°4215 par jameser239@gmail.com
jameser239@gmail.com lundi 1 juillet 2019, 00:06
Helpful Advice To Make Your Internet Business Be Worthwhile

Life can hit you by surprise sometimes. You might suddenly lose your career after working for many years, and you may be undecided about how to proceed. Have you contemplated opening up your personal work at home business? The subsequent article gives you advice on becoming your very own boss.

Challenging, though developing a business at home is fun. Find your niche, your area of expertise, and range from there. You need to understand it thoroughly, though it could be most situations. Do your homework before aggressively pursuing just one thing. Network with many other home based business owners that happen to be successful.

Enhance your website if your inventory has run on individual products. Clients are sure to be upset along if the products they ordered will require weeks to come directly to them. Give your customers the choice to chose other products and inform them when a product is on back-order.

It is important to put money into some business card printing. There are some Web sites where you can get business card printing for free. Be sure to include information such as your name, business name and telephone number. Don't forget to include your email and website addresses. Having this information is likely to make it easier for customers and clients to make contact with your small business in how that they can feel most comfortable.

Dress professionally, even though you may are working at home. Although you may feel as if wearing pajamas once you work in a home office, don't. You wish to still dress such as you are going into the office. This will improve productivity while focusing.

If you do business from home, limit your household interruptions. This may reduce the quantity of focus and production you have on important work issues, so make sure to let people know when you find yourself busy. Take care of these matters after the work day. Keep children make and supervised yourself available if you find an urgent situation.

You could utilize your skills to present lessons out of your home to bring in some income from home. Lots of people prefer to take lessons privately instead of via a school with rigid schedules. You may teach piano or guitar, or hobbies like knitting. Perhaps you are a sharp photographer. Teaching can make you money.

Prior to incorporate your home-based business enterprise, it may be beneficial to satisfy using a business lawyer. This can be a terrific way to develop a business and stick to state laws. You can study the laws of the state should you speak with a lawyer who deals running a business. You need to ensure you are abiding by them.

Your domain address ought to be feasible for individuals to remember. If you make the name complicated, people will find it difficult remembering it. Keep it simplistic and very catchy!

Whenever you get a payment, put it from the bank. As opposed to making a weekly or monthly bank deposit, make deposits daily or weekly. In the event you don't deposit a check without delay, it might get lost. Work with a teller to deposit your hard earned money through, instead of an ATM, to ensure the cash enters into your money.

As i have said, it seems that a recession might be coming again, though our company is inside an economic depression today. You may wish to know how you're going to make money to thrive. This post will help you avoid this and instead turn a nice gain.


https://www.blogger.com/blogger.g?blogID=4545609831985900489#allposts


geffen oody
facultatif
Facebook Twitter RSS Email
Forum Excel
Venez découvrir le nouveau forum excel question/réponse à la stackoverflow.com !
Forum Excel
hit parade n'en a rien a foutre du W3C Positionnement et Statistiques Gratuites Vincent Paré