问题
I have following line of code in my jsp:
<td><form:input type="text" class="disable1" name="projowner" id="projowner" path="projOwner"/></td>
on rendering in browser I found that the code is like this:
<td><input id="projowner" name="projOwner" class="disable1" type="text" value disabled></td>
I deleted the class="disabled1" in my jsp and found that the disabled attribute is no longer present in my HTML. I am trying to debug the code in chrome and want to see which script/css inserted the 'disabled' attribute to my code. While "inspecting elements" in chrome, I found in network tab that there were some javascript files getting downloaded while the page loads. I tried to find the text 'disabled1' in them but it was not present. I also tried to find it in the current jsp but still no luck. Is there any way, something like breakpoint or such in chrome debugger so that I can see which scripts ran on my particular line of code. I am using Bootstrap and apache tiles.
--edited--
Below is the image which shows that the page on loading doesn't contains the disabled attribute:
回答1:
Yes, this is a modification performed by the client code. There's a nice tool in Chrome's development tools that allows you to set a breakpoint on DOM attributes modification. After you've done that your browser will halt JS execution in the exact line that made the change, allowing you to figure out what's triggering it. The details are covered in Chrome's documentation.
This feature is also reportedly present in Firebug but I couldn't find it in an apparently newer version of the plugin.
回答2:
This could be happening server-side. Load your page and look at the network tab in the web developer tools and check the response body for the page request and see is the value disabled
text there. This is prior to any dom manipulation so if it is there then its the server side that is altering it when it is converting the 'form:' tags to valid html tags.
来源:https://stackoverflow.com/questions/25182296/cant-find-which-script-is-working-on-a-particular-line