Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Remove and load

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #41337
    XaviJr
    Participant

    Hi guys. I want to make this javascript code that get all tab contents from HTML, remove them, and then load them only when the user click on the tab. Is this possible?

    #117389
    Paulie_D
    Member

    What do you have so far?

    Do you have a link?

    Could you put something in Codepen for us to play with?

    #117392
    XaviJr
    Participant

    I don’t have an example code but I’m making one now.

    I know how to select the elements but I don’t know any function to remove the selected elements and other to load them. load() is just used to load external files right?

    #117394
    David_Leitch
    Participant

    As a starting point, the ‘[Tabbable Nav](http://twitter.github.com/bootstrap/components.html#navshttp://twitter.github.com/bootstrap/components.html#navs”)’ from Twitter Bootstrap comes to mind. I don’t know the workings behind it, but it seems to achieve what you’re looking for, so perhaps have a look at how that works?

    #117396
    XaviJr
    Participant

    Thank you for your tip David, I will look into the code of that to figure it out.
    If anyone have other tips please let me know. I prefer to understand how can this be done and not use an external library.

    #117405
    XaviJr
    Participant

    I want to really remove it but thank you for the input.

    #117407
    Paulie_D
    Member

    >I want to really remove it but thank you for the input.

    Actually, I don’t think so.

    I’m assuming that you don’t want it loaded on pageload at all but only want it to be inserted on a click event.

    Is that more like it?

    #117408
    XaviJr
    Participant

    Something like that, yes. But if I have the display:none the content is loaded anyway right? It’s just hidden.

    #117409
    Paulie_D
    Member

    > if I have the display:none the content is loaded anyway right? It’s just hidden.

    Yes it is….To be honest the solution will depend on what you effect are trying to achieve and why.

    #117410
    XaviJr
    Participant

    Let me try to explain.

    It’s like a plugin. I want to have the ability to grab the HTML objects, stop them from loading and then load it only with the click action. Like some slideshows do I think.

    #117412
    Paulie_D
    Member

    Yeah, but are you planning on having these ‘objects’ in your page HTML and hidden prior to load or inserted INTO the page HTML on a click.

    The two are different.

    #117414
    XaviJr
    Participant

    Inserted into, not hidden, because it can be videos/images so I don’t want to have a slow load. I hope I’m making myself clear.

    #117415
    XaviJr
    Participant

    I know andy, that’s why I made this question in Javascript section, but I don’t know what functions can I use to save, remove and load the HTML stuff. That’s my question.

    #117416
    Paulie_D
    Member

    There you go folks…I’m no JS / AJAX expert (or even a novice) but that’s what he’s after.

    Over to you.

    #117418
    XaviJr
    Participant

    Thank you both for clear that out.

Viewing 15 posts - 1 through 15 (of 21 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.