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 Link to comment https://forums.phpfreaks.com/topic/288487-code-i-have-incorrect/ Share on other sites More sharing options...
requinix Posted May 14, 2014 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(); }); }); 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 Link to comment https://forums.phpfreaks.com/topic/288487-code-i-have-incorrect/#findComment-1479494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.