N
N
Ncz2021-09-27 21:13:32
JavaScript
Ncz, 2021-09-27 21:13:32

jQuery not working on mac os in local html, how to fix it?

How to connect to local page.html jquery file? What would jquery scripts work on a local page
Tried:
- Connect through a file in a folder with page.html

<script type="text/javascript" src="jquery-3.6.0.min.js"></script>

- Connect through the same file via the Internet resource
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>



There is still no sense, it does not work ... Tell me what could be the matter?

System: Mac OS High Sierra
Browsers: Chrome, Safari, Mozila I'm

testing jquery on this script:
spoiler
html:
<html>
<head>


<!--Подключаем библиотеку-->
<script type="text/javascript" src="jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="style2.css">
<script type="text/javascript" src="base2.js"></script> 



<meta charset="utf-8">
 </head>
 <body>
 <p class="Zagalovok" >Главная</p>
  <title>Главная</title>
<div class="bookmarkList">
  <h2>
      Bookmark List
  </h2>
</div>

<div class="vidBx">

  <button class="getTime appp" onclick="javascript:;">click here</button>
  
  <video id="videoElement" autoplay controls width="100%">
    <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4">
    <source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg">
    <p>Your browser does not support the video tag.</p>
  </video>
</div>

<BR><BR><BR>
 </body>
</html>


base2.js:
var myVid = document.getElementById('videoElement');

$('.getTime').on('click', function() {
  var mycurrentTime = myVid.currentTime;
  $(".bookmarkList").append("<a href='javascript:;' rel='" + mycurrentTime + "' class='bookmarkLink'>" + mycurrentTime + "sec - Click to Play</a>");

  $('.bookmarkList a').click(function() {
    myVid.currentTime = $(this).attr('rel');
    myVid.play();
  });
});


style2.css:
.getTime {
  background: #f36e65;
  color: #fff;
  font-size: 12px;
  text-align: center;
  padding: 8px 10px;
  text-decoration: none;
  display: block;
  width: 150px;
  margin: 0;
  font-family: Arial;
  text-transform: uppercase;
  position: absolute;
  top: 0px;
  right: 0px;
  z-index:9;
}

.bookmarkList {
  background: #fff;
  color: #111;
  padding: 0;
  border: 1px solid #f36e65;
  margin-bottom: 1em;
  font-family: Arial;
  font-size: 13px;
}

.bookmarkList a {
  display: block;
  margin-bottom: 0;
  color: #f36e65;
  text-decoration: none;
  border-bottom: 1px solid #f36e65;
  padding: 5px 10px;
}

.vidBx {
  position: relative;
}

.bookmarkList h2{text-transform:uppercase; font-weight:normal; font-size:14px; font-family:Arial; color:#fff; background:#f36e65; padding:5px; margin:0;}

.appp{
display:inline-block;
}


The same code on jsfiddle.net https://jsfiddle.net/cp89db4u/1/
It works there, but if you run it on mac os, the script does not work, the button does not cause any actions

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2021-09-27
@sslion

check where your jquery is, see the browser console, what errors are there

B
BorLaze, 2021-09-27
@BorLaze

What does "doesn't work" mean? how do you call, what do you expect?
or do not call at all, connected, and that's it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question