This is a very simple question I know, but I have this jQuery code that has it's own default text. How can I make the following be the default output when the page loads?
<li><a href="/panasonic/index.php/site/pictureFeatured" id="featuredProducts" ></a></li>
Here's my code
jQuery
<script type="text/javascript">
$(document).ready(function() {
$("#pav li a").click(function() {
$("#promocont").empty().append("<div id='loading'><img src='loading2.gif' alt='Loading' /></div>");
$("#pav li a").removeClass('current');
$(this).addClass('current');
$.ajax({
url: this.href,
success: function(html) {
$("#promocont").empty().append(html);
}
});
return false;
});
$("#featuredProducts").click(function() {
$('#featuredProducts').css('background-position', '0 -46px');
$('#mostPopular').css('background-position', '0 0');
});
$("#mostPopular").click(function() {
$('#mostPopular').css('background-position', '0 -46px');
$('#featuredProducts').css('background-position', '0 0');
});
});
</script>
HTML
<div id="homemid">
<ul id="pav">
<li><a href="/panasonic/index.php/site/pictureFeatured" id="featuredProducts" ></a></li>
<li><a href="page_2.html" id="mostPopular"></a></li>
</ul>
<div id="promocont">
Deafult Text
</div>
</div>
I dont want a defualt text, I just want
<li><a href="/panasonic/index.php/site/pictureFeatured" id="featuredProducts" ></a></li>
That to be loaded. I mean the content of that link.
Thanks
Maybe you mean:
$('#promocont').load($('#featuredProducts').attr('href'));