Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Is there a better way of doing the same thing on multiple fields? Re: Is there a better way of doing the same thing on multiple fields?

#140671

1.) if you are using jQuery for no conflict mode try

jQuery(document).ready(function($) {
// You can use $ now.
// Even for wordpress, or working with other libs.
});

2.) Check out this (http://codepen.io/doublea79/pen/yjkiB”Code Pen Link”) I have put together a couple of examples.

3.) I did not tackle the .get url I think using the data-attr like Dillon recommended is probably your best bet. If that’s not an option I would create an object that holds the ID and the url to .get, but adding the data attribute would be way easier.

4.) I have not check any of the code so it might be riddle with errors, but should get you started in the right direction.

5.) if you are up for the challenge you might want to try writing this in using object literal routing for your .get urls.