Advertisement:

Author Topic: (solved)js error, need a second set of eyes  (Read 543 times)

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
(solved)js error, need a second set of eyes
« on: February 12, 2014, 08:29:18 pm »
so I am getting an error on safari that says this is not right missing or has to many (       "expected token '}'     )..I may never understand these errors...sigh

Code: [Select]
<script type="text/javascript">

$(document).ready(function(){

        $("#countryId").live("change",function(){

            var pk_c_code = $(this).val();

           
                var url = 'workingbu/index.php?page=ajax&action=regions&countryId='   pk_c_code;

           
            var result = '';

    var sQuery = 'ie. PHP Programmer' ;



    $(document).ready(function(){

        if($('input[name=sPattern]').val() == sQuery) {

            $('input[name=sPattern]').css('color', 'gray');

        }

        $('input[name=sPattern]').click(function(){

            if($('input[name=sPattern]').val() == sQuery) {

                $('input[name=sPattern]').val('');

                $('input[name=sPattern]').css('color', '');

            }

        });

        $('input[name=sPattern]').blur(function(){

            if($('input[name=sPattern]').val() == '') {

                $('input[name=sPattern]').val(sQuery);

                $('input[name=sPattern]').css('color', 'gray');

            }

        });

        $('input[name=sPattern]').keypress(function(){

            $('input[name=sPattern]').css('background','');

        })

    });

</script>
« Last Edit: May 31, 2014, 11:08:59 pm by design »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: (solved)js error, need a second set of eyes
« Reply #1 on: February 13, 2014, 12:00:18 am »
Hi, :)

Still a couple of lines more to close all those nested functions, I think the end of the script should be:

Code: [Select]
                $('input[name=sPattern]').keypress(function(){

                    $('input[name=sPattern]').css('background','');

                })

            })
        })

    });

</script>

Regards

PS.- Oh, I see now that the title of the thread already says "solved". :D
« Last Edit: February 13, 2014, 12:04:30 am by teseo »

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Re: (solved)js error, need a second set of eyes
« Reply #2 on: February 13, 2014, 12:03:00 am »
thanks, it ended up being the first part that needed it. the place holder function was not closed. trial and error-