I need to basically add this to my page:
<body onload="document.getElementById('WeddingBandBuilder').focus()">
However, due to my template, I cannot change the tag. So is there a way to make an equivalent with a script in <head> or something?
Thanks!
<script> window.onload = function() {document.getElementById('WeddingBandBuilder').focus()}; </script>
You should always be careful if not defined window.onload. I was burned several times, suggesting that I would only bind things to <body onload="...">or window.onload.
window.onload
<body onload="...">
See this answer and comments for a solution to this problem.
JS-, jQuery Prototype, script - :
jQuery:
$(function() { $('#WeddingBandBuilder').focus(); });
:
Event.observe(window, 'load', function() { $('WeddingBandBuilder').focus(); });
Can I check if this page is included in jQuery? If so, you can do something like this:
$(document).ready(function() { $('#WeddingBandBuilder').focus(); });
Source: https://habr.com/ru/post/1708819/More articles:GdiPlus OverflowException - c #Critically Efficient Server - javaSharing a simple executable file for multiple users? - c #Perl: moving along input lines using an index - perlRewrite for all urls - regexМожет ли mod_rewrite конвертировать любое количество параметров с любыми именами? - regexWebLogic "MDB application is not connected to the messaging system" - java-eehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1708822/qt-double-buffering-are-there-any-neat-tricks-to-capture-pixels-or-manipulate-the-back-buffer&usg=ALkJrhiJIvsdXJrJG2tBYV-D5NpvWiltiA"Устаревшая" нотация для компилятора Sun С++? - c++wcf: adding username to message header is safe? - securityAll Articles