I have a html file and some css written inside style tag. I have requirement to extract text inside this tag. eg:
<style>
html,body {
margin: 0px;
width:100%;
}
.center-text {
text-align: center;
}
</style>
I need to extract values inside this tag in a string using jquery. I tried several posts but couldn't get any appropriate answer.
have you tried this?
$("#YourDiv").html($("style").html())
this will get css code as string and put it into div if you need to save it to db you can send it via ajax to your server
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.