WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a lengthy form config for my widget so I thought about using radio buttons to hide and show the relevant input fields instead of having them all after each other. But it doesn't seem to work. I suppose it is because the form is loaded with ajax? Is there a way to get it to work?

Take a look at the code here: http://jsfiddle.net/JmVL3/

share|improve this question
What does your browser's debugger say? – toscho Sep 26 '12 at 22:59
It doesn't say anything. Neither firebug or chrome gives any errors. I've just noticed that it works fine to alert a message instead of hiding/showing the input field when clicking the radio buttons. – John Sep 26 '12 at 23:05
It also works everywhere else on the admin page. Just not inside the widget settings. I tried to use .ajaxsucces() around the code but it didn't seem to help. – John Sep 26 '12 at 23:13
Another thing. It also works if i enable accessibility mode. – John Sep 26 '12 at 23:23
@toscho, I can reproduce the issue, it is possible to see the manipulations happening in the Html code (i.e.: $("#field2").css('display','block');), but the widget form shows no change... – brasofilo Nov 10 '12 at 23:30

I just had the same issue, which I resolved by changing all my IDs to classes. Remember that widgets can be used multiple times on page, so specifying an ID anywhere increases the likelihood that you'll have ID duplication (Which will in turn cause jQuery to have a fit).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.