Grow your CSS skills. Land your dream job.

Problems with simple JQuery functions (hide/show)

  • # October 6, 2008 at 8:29 am

    I am attempting to hide and disable a DIV class (see code below) and I cannot for the life of me figure out what I am doing wrong.

    The code below is actually suppose to hide a DIV of class "optional-field" unless you choose a certain option from the drop down form with select name of "productOptions[2]". This might be an odd "select name" but it is because it is dynamically created by PHP. But if you choose "Someone Else" it should "show()" that DIV. It should also hide it wheen page loads.

    However, dispite that, I tried just doing a simple hide command of another div not dynamically created

    Code:

    and I can't even get that to hide.

    Below is the code for both the function and then the HTML:
    NOTE: for the form select name, the HTML code shows the PHP place holder of

    Code:

    but when created it is

    Code:

    Javascript:

    Code:

    HTML

    Code:



    {VAL_OPTS_NAME}
    {VAL_OPTS_NAME}

    ({VAL_OPT_SIGN}{VAL_OPT_PRICE})




    What am I missing?

    # October 7, 2008 at 5:00 am

    Make sure you’re loading the jQuery functions you’re wanting to use.

    Code:
    $(document).ready(function()
    {
    $(“#boxContent”).hide();
    })

    This should be how all of your stuff should look. Basically it shows that jQuery is to be loaded once the DOM is finished loading. Should solve your problem.

    # October 8, 2008 at 7:47 am

    Thanks all for the input. It turned out to be that it didn’t like where I had the <script>…./jQuery.js</script> put as far as order AND because I was also using the scriptaculous.js and prototype.js which were also causing conflict.

    Thanks,

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".