Reputation: 1587
I working with the following form on a WordPress website:
<input id="abc_settings[update_date]" name= "abc_settings[update_date]"
type="checkbox" value="1" <?php checked('1', $abc_options['update_date']); ?>/>
If I change the id to "update", I can select it using
value = $('#update').val();
However, I couldn't figure out how to get the value of abc_settings[update_date]
.
This one is not working:
value = $('abc_settings[update_date]').val();
I keep the name abc_settings so that I can use global $abc_settings
and global $abc_options
in WordPress.
Any help would be appreciated.
Upvotes: 0
Views: 58
Reputation: 1670
Try to escape the [
and ]
characters like this:
value = $('#abc_settings\\[update_date\\]').val();
I'm not entirely sure if that will work, but I'm basing it off of this:
Upvotes: 1