Reputation: 6574
Ok so the other day I asked about using .load
with a variable, and well it stuck very well and glad that SO could help me. I have another question though, I am trying to limit the elements that are being loaded, I am calling .tdtopics
and it will load all the .tdtopics
from the page url i am loading. Instead I want to limit it to say 5 and that is it.
Two Codes I tried one is all elements other is one element only.
$(function(){
$('body').append('<span id="view_mess">New Message</span><div id="mess_wrapper"><div id="new_mess_pop"></div></div><div id="message_holder"></div>');
$('#message_holder').load('/privmsg?folder=inbox .tdtopics');
$('#view_mess').click(function() {
var msg = $('.tdtopics a').attr('href');
$('#new_mess_pop').load(msg + ' .post');
$('#mess_wrapper').show();
$('.postfoot').remove();
});
$('#mess_wrapper').click(function(){
$(this).hide();
});
});
....
$(function(){
$('body').append('<span id="view_mess">New Message</span><div id="mess_wrapper"><div id="new_mess_pop"></div></div><div id="message_holder"></div>');
$('#message_holder').load('/privmsg?folder=inbox .tdtopics:eq(0)');
$('#view_mess').click(function() {
var msg = $('.tdtopics a').attr('href');
$('#new_mess_pop').load(msg + ' .post');
$('#mess_wrapper').show();
$('.postfoot').remove();
});
$('#mess_wrapper').click(function(){
$(this).hide();
});
});
Also for any hints on this would be nice, though I am going to read up on it later, I want to know if I could present this a plugin, and exactly how to start that? I think i would start off with $.fn.function
then create the defaults? Like I said I'm going to read on this anyways, just wanted to know if any SO users had any advice on creating the plugin
Upvotes: 0
Views: 614