Skip to main content

Forums

Forum Replies Created

Viewing 7 posts - 61 through 67 (of 67 total)
  • Author
    Posts
  • in reply to: Drop Down Not Working – jQuery #158873
    Chromawoods
    Participant

    You have registered the click handler before the element is even existing in the document. If you load the page with dev tools console open, you’ll see Cannot call method 'click' of null so jQuery doesn’t know about $(this).siblings('.controls') yet..

    You have two alternatives. Either run that piece of script in the bottom of the page (you should try to put as much as you can there to avoid render blocking). Or, wrap your event handler in jQuery’s $(function() {});, like this:

    $(function() {
        $('.open_controls').click(function(e) {
            e.preventDefault();
    
            $(this).siblings('.controls').fadeToggle(200);
        });
    });
    
    in reply to: Need to remove color of other div using onclick #150704
    Chromawoods
    Participant

    Hmm.. that code is a bit tricky to read at the moment. :) I think I understand what you aim to do though. Could you post an example of how the HTML looks? I suspect that you are making the solution more complicated than it needs to be.

    in reply to: Date of Birth datepicker #150241
    Chromawoods
    Participant

    If you’re using jQuery, then have a look if one of these might do the trick:

    http://www.unheap.com/section/inputs-forms/date-time/

    in reply to: Menu problems #148873
    Chromawoods
    Participant

    Where is that JS located, I assume it is not just floating above the HTML like that? Is it even inside a <script> tag? Included somewhere? When is the JS executed, could it be executing before the HTML exists?

    in reply to: Jquery conflict – please help! #147793
    Chromawoods
    Participant

    On test-modal.html: jQuery is included AFTER a bunch of other jQuery-dependent plugins, which causes a whole bunch of errors. I would start there. Include jQ before the plugins.

    On test-loading.html: The dollar variable ($) is used by some other function and is not used by jQuery, so no jQuery stuff that you do with $ will work there. If you want to use $ instead of using its alias, jQuery, you can achive it quite easily. If all you need is to do stuff at document ready, then replace this:

    $(document).ready(function() {

    …with this: jQuery(document).ready(function($) {

    Now you have passed jQuery to that scope as $ and it will not interfere with that other $ function.

    I don’t know how much control you have over all the other code on that site, but one solution would be to find that weird function that has hijacked the $ variable and call it something else, but then you need to fix all calls to that function to be sure that you don’t break stuff in other places.

    in reply to: Tabs not working #146598
    Chromawoods
    Participant

    First of all, when you say “version of js” you really mean “version of jq, or jQuery”. jQuery is built on JS but it’s weird to say “version of js” because that’s a whole other deal. But, maybe it was just a typo. :)

    Yep, the jQuery dollar variable ($) is undefined on your site. Taking a closer look, it seems that the jQuery script that you have included is not identical to the one on, for example, http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js

    Look at the very bottom of your jQuery file http://marensblog.dk/wp-includes/js/jquery/jquery.js That last line that says

    jQuery.noConflict();

    Did you add this line? It is what’s causing these errors, because it tells jQuery to “forget” about the $ variable by setting it to whatever value it had before jQuery was loaded, in your case undefined.

    Long story short: Remove that last line from your jquery.js file.

    in reply to: Set value of html label #146597
    Chromawoods
    Participant

    You mean something like this?

    document.getElementById("test").innerText = 'Whatever';

    Or, if you need to add some HTML to that value:

    document.getElementById("test").innerHTML = 'Whatever makes you <em>happy</em>';

Viewing 7 posts - 61 through 67 (of 67 total)