jpopuk Posted May 14, 2014 Share Posted May 14, 2014 I have a small bit of jquery code that is not working: $(function() { $(‘’[name=\'pet_type\']”).change(function() { $(‘’[name=\'breed\']”).removeAttr(‘disabled’); $(‘’[name=\'breed\']”).children(‘data-pet-type[name!=\'’ + $(this).val() + ‘\']’).hide(); $(‘’[name=\'breed\']”).children(‘data-pet-type[name=\'’ + $(this).val() + ‘\']’).show(); }); }); My javascript is not good at all, so cannot spot errors? Any help would be much appreciated! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/288487-code-i-have-incorrect/ Share on other sites More sharing options...
Solution requinix Posted May 14, 2014 Solution Share Posted May 14, 2014 Tons of them: don't use smart quotes. $(function() { $("[name='pet_type']").change(function() { $("[name='breed']").removeAttr("disabled"); $("[name='breed']").children("data-pet-type[name!='" + $(this).val() + "']").hide(); $("[name='breed']").children("data-pet-type[name='" + $(this).val() + "']").show(); }); }); Quote Link to comment https://forums.phpfreaks.com/topic/288487-code-i-have-incorrect/#findComment-1479487 Share on other sites More sharing options...
jpopuk Posted May 14, 2014 Author Share Posted May 14, 2014 Thank you Quote Link to comment https://forums.phpfreaks.com/topic/288487-code-i-have-incorrect/#findComment-1479494 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.