Sunday, 15 September 2013

javascript - Ensuring my custom jQuery does not interfere with other id's with same name -



javascript - Ensuring my custom jQuery does not interfere with other id's with same name -

i have wordpress plugin uses jquery function hide/show parts of plugin.

if ($('#display_linkedin_icon').val() == 'true') { $('#linkedin').show(); }

my issue in wordpress dashboard plugin adds element id of #linkedin when activate hiding of div in plugin hides other div in wordpress dashboard.

at stage not easy task alter name of id's.

i wondering there way can wrap above jquery function activate on plugin page.

i have #linkedin div wrapped in outer div called "asw-sortable". hoping wold work.

if ($('#display_linkedin_icon').val() == 'true') { $('#asw-sortable #linkedin').show(); }

any help appreciated.

that lastly thing did should have worked. did work?

if ($('#display_linkedin_icon').val() == 'true') { $('#asw-sortable #linkedin').show(); }

if not should seek create selector more specific.

javascript jquery conflict

No comments:

Post a Comment