Jump to content

Code I have incorrect...


jpopuk

Recommended Posts

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

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();

});

});

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.