JQuery Uniform Update not working

I am using a jquery form in one of the projects I'm working on. Since this is the admin panel, I really have no way to show. I will explain my problem

What I'm trying to do is pretty simple. I add some form elements (e.g. check box, check box, text input) to the page using ajax.

Every thing works, except for re-modeling these dynamically added form elements.

function step2 () { $.post( siteUrl + "includes/ajax/members/add-subscription.php?do=step2", $("#selectedSubscribers").serialize(), function( data ) { $('.step2_content').html(data); $.uniform.update(); }); } 

Has anyone experienced a similar problem? Even my onClick, onChange functions work without problems (dynamically added form elements), it's simple, $.uniform.update(); doesn't seem to work.

I thought it might take longer to process the data, so $ .uniform.update (); called before data processing, so I have not tried $.ajax with async: false .

I would be glad if someone who has experienced such a problem or who knows a solution can help me solve this problem.

Thanks in advance.

+7
source share
5 answers

The first time $.uniform() called, it collects all the specified elements into an internal array of the affected elements. When you call $.uniform.update() , it simply restores those elements that have already been collected.

To add additional elements, you may need to call $.uniform() again, passing a selector that identifies only those new, dynamically added elements.

+14
source

for load () if the problem is fixed

 $('#dialog').load(url + ' #forload', function() {$('#dialog').find('select').uniform(), $('#dialog').find('input:checkbox').uniform()}) 
+5
source

Another solution might be this

 setTimeout("$('.uniform_element').uniform();",200); 

200 or a larger number may be required.

+1
source

Have you tried this?

 $.uniform.update("#select_element_id"); 

In my case, he solved the problem.

The old version may have a problem like yours.

+1
source

Use this $ ("ElementClass.) Uniform () ;.

0
source

All Articles