Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.