JQuery .load() into variable or hidden element

前端 未结 2 1484
[愿得一人]
[愿得一人] 2020-12-22 10:50

I am pulling data from a section of one page into another in order to build a menu. I need to pull the data into a hidden element or variable as right now I end up with a d

相关标签:
2条回答
  • 2020-12-22 11:20

    It does not matter whether the element you are loading into is hidden or not. If it exists in the DOM then you can load into it.

    Either make sure the element is hidden via CSS first:

    #element{display:none;}
    

    or

    Hide the element with jQuery when you load the content into it:

    $('#holder').hide().load('mypage.php');
    

    Hope this helps you man!

    W.

    0 讨论(0)
  • 2020-12-22 11:31

    a $.get() would suit your purposes better than a $.load()

    using $.get() you can process the data before loading it into the page

    0 讨论(0)
提交回复
热议问题