im trying to create a function to help me change some css without having to repeat the code every time.
this is my code:
function error(e){
e.css({
'border':'2px solid red',
'background-color':'rgba(250,52,5,.2)'
})
}
as you can see i'm adding the (e) parameter, so i can apply the function to any element.
the function works fine but im getting the following error:
Uncaught TypeError: Cannot read property 'css' of undefined at error (scripts1.js:83)
there's any other or a better way to do this? sorry about my english and this simple question, im a begginer as you can see.
Thank you.
$(e).css(...)eforerror? In other words, how do you callerror?error(), not in the function itself. You need to show that code.