Search code examples
javascriptjquerywordpressinputmeta-boxes

Wordpress jQuery .val statement error


I can´t solve my issue with the jQuery .val(). I want to spice up, the site creation functions on my website and there I have several metaboxes to choose header layout and so on. There I want to show or hide metaboxes based on my choices. I´ll get an error in line 18 and have no idea how to solve it...

It´s difficult to explain, so created a simple Fiddle. It would be really nice, if someone can take a short look on the code. Thanks a lot!

[Fiddle]

[Fiddle]: http://jsfiddle.net/Blackzet/2Lr2g09p/1/

Solution

  • You've forgotten the dollar sign ($) in a few places:

    else if ($(this).val()=="masthead" && ("#_zet_titel_layout").val()=="show_zet_title") {
    

    has to be:

    else if ($(this).val()=="masthead" && $("#_zet_titel_layout").val()=="show_zet_title") {