Bobby X
asked on
Need help with jQuery elements filtering
Hi,
How do I filter the list of elements below so that $('button,a') will use css('cursor','pointer') and $('input,select,textarea') will use css('cursor','text')? I'd like to be able to chain everything together so that only "button" and "a" will use the cursor "pointer" and the others will use cursor "text".
var myElemList = $('button,input,select,tex tarea,a'). filter(fun ction(){
return $(this).hasClass("some-cla ss);
}).prop('disabled',false)
.css('cursor','pointer')
.click(function(){return true;});
Many thanks in advance.
How do I filter the list of elements below so that $('button,a') will use css('cursor','pointer') and $('input,select,textarea')
var myElemList = $('button,input,select,tex
return $(this).hasClass("some-cla
}).prop('disabled',false)
.css('cursor','pointer')
.click(function(){return true;});
Many thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
jquery is better suited for interactions, when it comes to styling you should stick to css, even if you want to change the way things look use jquery or javascript to add classes to html elements, but specify the styles in CSS