![]() |
Load div content from other pages depending on select choice
Hi!
I try to load content into my site from other pages (in same site) but its not working. I made four pages in same root: Index.html one.html two.html three.html In Index I have a select element with ID "selectchoice": Code:
<select id="selectchoice>Code:
<div id="get_content"></div>Then I place this code in the header if Index.html, after the jQuery-file link. Code:
<script>Kinda new to scrips and programming so do not be suprised if there is any standard error. Is anybody find the error? |
<select id="selectchoice> needs a closing " for the id.
The .change() function isn't dependent upon selectedIndex or value of the selected option. |
Code:
<script> |
Yeah, what DanInMa said..
:) |
Thanks for the help. It works now! :)
|
Trouble when load.in ui-slider to div with jQuery
Hello again,
This is kinda a continuation on my thred about load in content from a external page to a div depending on choice in a select-box. (http://www.codingforums.com/showthread.php?t=284405) I use this code to load in content: Code:
$(document).ready(function(){ When this code tries to load in a div containing a ui-slider element the graphics dont show up. The slider is there but its hidden becuse if I place one slider in the page from pageload/start (visible) and one slider in the div that gets loaded (invisible), then give them same ID so the slide handle-bars move at the same time (when only moving one), in the exaxtly moment of moving the visible slider the invisible slider shows up. Its feels like it dont have any CSS rules when loaded in and then it gets the same rules at the other slider when its have to work. Have anybody here experienced anything similar before? Sorry for some incorrect english. |
Most likely, it's because the content is not loaded at page load, so there is nothing to initialize. Have you tried placing the init within the content that is being loaded?
|
Quote:
What do you mean by placering the init? (Sorry my first week at jQuery) |
Usually, in jQuery, things like sliders, scrollers, etc., have to be "initialized" after content has loaded. For example, if you are using nanoScroller (Mac style scroll bar, cross browser), if the div that is using nanoScroller doesn't have any content, it doesn't have height, so when you init by using $('#divName').nanoScroller();, it doesn't work because nanoScroller doesn't "see" anything there.
|
Quote:
Thanks for you answer by the way. |
you may need to call the nanoscoller each time you load a div in your case statements
|
Quote:
|
Basically, place the src to jQuery in each HTML file that is being dynamically loaded, and initialize the slider in each page in the $(document).ready() function. That way it initializes on each page load.
|
Quote:
Code:
$(document).ready(function(initialize){ |
my original example was already contained within a shorthand version of $(document).ready..... so anyways..
Code:
$(function () { |
| All times are GMT +1. The time now is 10:11 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.