in JQuery coding, we determine if an element has an attribute. JQuery is easy to determine because of the method hasClass $(“input[name=new]”).hasclass (“new”).
, but sometimes we need to determine other attributes, such as a link with rel or no rel. How do you tell?
If there is an attribute $(“#aid”).attr(“rel”) will return the value of rel, or if there is no rel” undefined”
undefined is undefined type, if($(“#aid”).attr(“rel”)==”undefined”) this judgment may not be true.
because of different types. p> it is recommended to use an if (typeof ($(” # aid “). Attr (” rel “)) = = “undefined”)
- ES6 determines what the string begins with or ends with
- Solution of running error reporting attributeerror: ‘rectangle’ object has no property ‘normalized’
- Golang determines whether the directory is empty
- JQuery: How to get the selected values of checkbox, radio and select
- [Solved] jQuery Error: Uncaught TypeError: this.attr is not a function
- Error reported by nodejs server of CentOS system: solution to cannot find module ‘jQuery’
- Django + jQuery get data in the form + Ajax send data
- Solution to report undefined a error when using jquery
- Uncaught type error: cannot read property ‘MSIE’ of undefined
- about jQuery.js The solution to always reporting errors
- JQuery is a solution to the disappearance of listening events after adding elements with append
- HTML method IE8 reports an error, IE8 jQuery Ajax obtains static resources reports an error, typeerror denies access
- Browser prompt: Source mapping error: request failed with status 404 Source URL: http://xxx.js Source mapping URL: jquery.min.map
- Mybatis property loading order [How to Solve]
- [jQuery] jQuery operates on JSON strings or JSON objects
- Vue uses this. $refs. Subcomponent Ref. method to report an error: cannot read property ‘resetfields’ of undefined problem
- Beautiful soup4 gets the value of the class property of the tag
- Property xxx was accessed during render but is not defined on instance
- Property or field ‘Title‘ cannot be found on object of type