Just call addClass()
. jQuery will do the check for you. If you check on your own, you are doubling the work, since jQuery will still run the check for you.
More Related Contents:
- jqGrid custom format fails on addClass
- if checkbox checked add class to parent element
- delayed addclass/remove class function not working
- Benefits of using attr() over addClass in jquery
- addClass and removeClass in jQuery – not removing class
- jQuery validate: How to add a rule for regular expression validation?
- jQuery selector value escaping
- Selecting the first “n” items with jQuery
- jquery find versus context selection
- jquery get HTML 5 Data Attributes with hyphens and Case Sensitivity
- Fade in each element – one after another
- css width: calc(100% -100px); alternative using jquery
- How to set encoding in .getJSON jQuery
- How to fade changing background image
- What is the best way of showing progress on an Ajax call?
- jQuery resize function doesn’t work on page load
- jqGrid : issue loading nested sub grid with local datatype
- How do I force jQuery append to NOT automatically close a tag?
- Aptana Plugin for Eclipse and jQuery code assist
- click() event is calling twice in jQuery
- Show Page Loading Spinner on Ajax Call in jQuery Mobile
- Jquery JQGrid – How to set alignment of grid header cells?
- Cannot load an external page with jQuery.load into a div in my page
- How to preview selected image in input type=”file” in popup using jQuery? [duplicate]
- Can someone explain how to implement the jQuery File Upload plugin?
- Why jQuery UI 1.10 remove jquery dialog zIndex option?
- Getting the current src of an Iframe using JQuery [duplicate]
- jQuery is adding a strange attribute to nodes
- Reading the selected value from asp:RadioButtonList using jQuery
- JavaScript – Escape double quotes