Home Download Buy Blog Forum Support

Syntax highlighting for JS in html attributes (ex: onclick)

Syntax highlighting for JS in html attributes (ex: onclick)

Postby Dr. Azzy on Thu Jan 09, 2014 9:32 pm

Is it possible to get Sublime Text 3 to use javascript syntax highlighting on javascript in the attributes of HTML elements (stuff like onclick, onkeypress, etc)?

For example, if I wanted highlighting for the JS here:

Code: Select all
<div id="search">
   <div class="searchdiv"><input id="searchfield" onkeypress="if (event.keyCode == 13) {doSearch(this.value,1);}"/></div>
   <div class="test" onclick="doSearch(document.getElementById('searchfield').value,1)" ><canvas id="searchbtn2" width="68px" height="68px"/></div>
   <div class="test"></div>
   <div class="test"></div>
   <div class="test" onclick="doSearch(document.getElementById('searchfield').value,Math.max(window.currentpage-1,1))"><canvas id="prevbtn" width="68px" height="68px"/></div>
   <div class="test" onclick="doSearch(document.getElementById('searchfield').value,(window.currentpage+1))"><canvas id="nextbtn" width="68px" height="68px"/></div>
</div>


Thanks
Dr. Azzy
 
Posts: 4
Joined: Thu Jan 09, 2014 9:04 pm

Re: Syntax highlighting for JS in html attributes (ex: onclick)

Postby Dr. Azzy on Wed Jan 22, 2014 6:34 pm

I hate to come back and bump my thread, but... anyone have any thoughts on this? It seems like it would be a common thing to want to do.
Dr. Azzy
 
Posts: 4
Joined: Thu Jan 09, 2014 9:04 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests