jQuery(function() {
jQuery('a.addTitleTag').click(function() {
titleText = jQuery(this).parents('p').attr('title');
jQuery("input[name='pmName']").val(titleText);
});
});
jQuery(function() {
jQuery('a.addTitleTag').click(function() {
titleText = document.title; // Placed in new var incase of extra manipulation needed.
jQuery("input[name='username']").val(titleText);
});
});
$("p[title='username']").find('a').click( function{ //Onclick for the a in the p tag
contentOfP = $("p[title='username']").html(); //get the content of the p tag, including the <a> tag
positionOfDash = contentOfP.indexOf('-'); //We need the position of the dash to determine where the 'Firstname Lastname' part of the P tag ends
names = contentOfP.substr(0, positionOfDash); //Get the start of the P tag withouth the dash
$("input[name='pmAmne']").val( names ); //Set the value of the input
return false; //Block the default event for the link so it doesn't jump to the top of the page on long pages
});
<script type="text/javascript">
(function update()
{
$.ajax(
{
type: 'GET',
url: '/doGet/pmKontakter.php',
timeout: 2000,
success: function(data)
{
$("#pmKontakter").html(data);
$("#loadingComponent").html('');
window.setTimeout(update, 10000);
},
error: function (XMLHttpRequest, textStatus, errorThrown)
{
$("#pmKontakter").html('<h3>Din kontaktlista kunde inte hämtas för tillfället.</h3>');
window.setTimeout(update, 60000);
}
});
})(jQuery);
</script>