I would just like to to ask if its possible to insert a jQuery variable on an attribute. Here is my sample code:
<html>
<head>
<script type="text/javascript">
$(function() {
var url = 'http://www.google.com';
var data = '?one=1&two=2&three=3';
});
</script>
</head>
<body>
<a href="jquery var">Click here</a>
</body>
</html>
I need to put the jQuery var value of the href. How can I do that? Thank you in advance. ;)
Sure.
$(function() {
var url = 'http://www.google.com';
var data = '?one=1&two=2&three=3';
$('a:first').attr('href', url + data);
});