Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "Expected ',' or '{' but found '[selector]'" error

Getting "Expected ',' or '{' but found '#44559'" error. My code looks like this:

var valueid = $("div#center-box div#empid-textbox input").val(); //valueid=44559
if($("div#esd-names li#" + valueid).length > 0){
   //DO SOMETHING;
};

I'm getting the value of what is entered into a textbox input field which in case is "44559" can't seem to figure out why I'm getting this error.

I call my valueid retrieving function with the following code. After you press ENTER in a specific textbox the value of the textbox is retrieved and ran against list items to see if it exists...if it does -- //DO SOMETHING//

$("div#center-box div#empid-textbox input.id").keypress(function(e){
  key = e.which;
  if(key===13){
    valueid = $("div#center-box div#empid-textbox input").val();
    if($("div#esd-names li[class*='" + valueid + "']").length > 0){
       //DO SOMETHING;
    };
  };
});
like image 850
sadmicrowave Avatar asked Dec 08 '25 15:12

sadmicrowave


1 Answers

You are using a number as an id. This is not allowed.

like image 199
kgiannakakis Avatar answered Dec 10 '25 23:12

kgiannakakis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!