Content deleted Content added
Ohconfucius (talk | contribs) →Updates: question |
→Updates: In these cases, the event.preventDefault() is to avoid scrolling to the top of the page when clicking in the link (which is what a link with href "#" would do by default - you can check that commenting the line and clicking in the link). Thi |
||
Line 39:
::::Noted. I never knew what those IDs' functions were, and the fact they were the same never caused any problems. Now renamed. I will do that for my other scripts too. --<small><span style="background-color:#ffffff;border: 1px solid;">[[User:Ohconfucius|'''<span style="color:#000000; background-color:#00FF00"> Ohc </span>''']]</span></small>[[User talk:Ohconfucius|<sup>''¡digame!''</sup>]] 03:52, 13 August 2014 (UTC)
*{{ping|Helder.wiki}} So, if I need to improve the other scripts (like [[User:Ohconfucius/test/formatgeneral.js|formatgeneral.js]]), presumably I need to put <code>e.preventDefault();</code> as the first line in each driver (the one activated directly by the button) and then change the syntax for the click buttons? Would I do that for <code>Ohc_run_formatgeneral()</code> only, or do I need to do it for <code>Ohc_downcase_headings()</code> and <code>Ohc_eject_zh()</code>, both of whose functions reside in a subscript? And what does that <code>e.</code> line do anyway? --<small><span style="background-color:#ffffff;border: 1px solid;">[[User:Ohconfucius|'''<span style="color:#000000; background-color:#00FF00"> Ohc </span>''']]</span></small>[[User talk:Ohconfucius|<sup>''¡digame!''</sup>]] 02:58, 15 August 2014 (UTC)
*:{{reply to|Ohconfucius}} In these cases, the [http://api.jquery.com/event.preventdefault/ event.preventDefault()] is to avoid scrolling to the top of the page when clicking in the link (which is what a link with href "#" would do by default - you can check that commenting the line and clicking in the link). This is necessary in each function used as a click handler for a link, such as <code>Ohc_run_formatgeneral</code>, <code>Ohc_downcase_headings</code> and <code>Ohc_eject_zh</code>. [[User:Helder.wiki|Helder]] 03:25, 15 August 2014 (UTC)
|