I want to insert a style in external style sheet. Can anyone help me to do this?
The below code is not useful for me because it insert css as inline
$("#id").css('border','2px solid red')
I want to insert a style in external style sheet. Can anyone help me to do this?
The below code is not useful for me because it insert css as inline
$("#id").css('border','2px solid red')
I think what you're saying is: using your example code it inserts as inline styles rather than creating its own external style sheet with the style that is then applied to your DOM.
If so read this. It's from 1996 (woo!) but shows how to create <style>
elements using javascript (so your CSS will live in the HTML <head>
and not be inline. In terms of using Javascript to create external stylesheets? No idea, hopefully someone else can help.
Edit: found this on SO: How to create a <style> tag with Javascript so no need to rely on something from '96.