Can we use Jquery on the edit/add pod item page?

0

I'm trying to use Jquery on the add/edit pod item page. I have a pod named 'matches' that holds the information for some boxing matches. I tried to write some elementary JQuery to test. I'm able to spit out an alert(), but not manipulate any of the elements in the form.

I've tried this is a display helper & as an input helper

<script type="text/javascript">
var $ = jQuery;
$('input.match_fighter2Helper').remove();
</script>

I haven't been able to do anything to any of the fields in the form on the add/edit pod item page. Is this becuase it's added in with ajax? Or are we not allowed to manipulate the form in pods?

Any help or advice is much appreciated....

Thanks

asked Oct 28 '10 at 11:08

lancebutler

1

add comment
enter at least 15 characters

6 Answers

0

I've also tried the above in a custom script that's loaded on every admin page when logged into wordpress

answered Oct 28 '10 at 11:10

lancebutler

1

add comment
enter at least 15 characters
0

Try inserting this in the address bar (i don't know correct english translation for this; just a place in browser, where you're typing url):

javascript: jQuery('input.match_fighter2Helper').remove();

Does this work? If not, are you sure that inputs you don't need do really have class 'match_fighter2Helper'?

answered Oct 29 '10 at 3:30

Fike

208

edited Oct 29 '10 at 3:30

add comment
enter at least 15 characters
0

Hey thanks for the reply. I don't know if you mean search for it. But it is specific to my pod so nothing came up.

I made the form field fighter2 in my boxer's pod. And it is a pick/relationship in my matches pod. Using firefox firebug, I see the form input element gets a class of match_fighter2Helper automatically. But when I view page source it's not there??

This is logged in a admin, and adding a new match. Choosing fighter1 or fighter2, I wanted to use jQuery on the input field and can't select it....Maybe we just can't change the input fields with jquery?

answered Oct 29 '10 at 9:07

lancebutler

1

add comment
enter at least 15 characters
0

we can, and it's pretty hard to block it. try something like alert(jQuery('input.match_fighter2Helper').html()) - this should output the insides of an element, so this will tell if jQuery finds this element.

answered Oct 30 '10 at 1:15

Fike

208

add comment
enter at least 15 characters
0

Thanks,

I tried it and it's alerting 'null'. I can inspect the input field with firefox's firebug, I know i'm getting the right selector '.match_fighter2Helper', but the form fields aren't in the source when i view page source.

The edit pod item form seems to be brought in with this code: <div id="editArea" class="area"> <div class="pods_form"> <script type="text/javascript">showform('matches')</script> </div> </div>

Could that be why I can't select it with jquery?

answered Oct 30 '10 at 8:05

lancebutler

1

add comment
enter at least 15 characters
0

<div id="editArea" class="area"> <div class="pods_form"> <script type="text/javascript">showform('matches')</script> </div></div>

sorry forgot the code that's inluding the edit pod item form

answered Oct 30 '10 at 8:06

lancebutler

1

add comment
enter at least 15 characters