Chrome extension google docs api get request, how to get cursor location?

I am making a chrome extension that does some google docs text insertion. I need to find the cursor location. using:

https://developers.google.com/docs/api/reference/rest/v1/documents/get

I get the document data back, but the cursor location is not included. Google apps scripts seems to be able to retrieve it (see https://developers.google.com/apps-script/reference/document/position).

But I don’t want to use Googla apps scripts unless I have to (some have said extensions and google apps scripts don’t mix well).

How do I get the cursor location using API calls for google docs?

Why is jQuery .val() returning nothing?

I am trying to get the value of an input. Here is what my form looks like:

enter image description here

This is the HTML for it:

<label for="userName"></label>
<input type="text" class="form-input plain-text" id="userName" placeholder="Username">

Here is the jQuery to get its value and log it:

$("#loginSubmit").click(function() {
    var userName = $("#userName").val();
    console.log(userName);
});

But when I type in some text and hit the login button that has the id #userName, the console returns this:

enter image description here

Why does this not output dwedwed in the console?

Thanks

Dart RegExp: FormatError: Unterminated group

I get this error and don’t understand why or what it means:

FormatError: Unterminated group (?<root>[A-G](#|b)?)(?<suffix>[^/]*)?(/(?<bass>([A-G](#|b)?))?
const String rootPattern = r"(?<root>[A-G](#|b)?)";
const String suffixPattern = r"(?<suffix>[^/]*)?";
const String bassPattern = r"(/(?<bass>([A-G](#|b)?))?";
final RegExp chordRegex = RegExp("$rootPattern$suffixPattern$bassPattern");

I need to split up chords like this:

Abadd9/C#
root: Ab
suffix: add9
bass: C#

Currently unable to handle this request. HTTP ERROR 500 on a specific page of site

I am getting this error on only a specific url of site i.e:

https://trafficwardenatd.com/abttrafficpolice/learningSlip.php

Rest of my site is working fine. I have tried the following techniques till now and they are not working.

  1. create a new .htaccess file.
  2. Disable all the plugins.
  3. Increase the PHP memory limit.
  4. Updated the wordpress wp-admin and wp-includes directories with latest downloaded directories.

Can any one help me to sort out this error?

Thanks

How to get specific element inside of element stored in variable?

I am looking for way to select element inside of already located element in variable. For example I have selected a container:

let productAttachedFilesModal = document.getElementById('modal_more_information');

I know, that inside are array of a elements, which I want to select as well. Which method should I use? in jQuery there are method find(). So I need the analog for JS.
Or I need to use DOM method again? Like this:

let listOfLinks= document.getElementById('modal_more_information > a');

Modifying Formspree code to send contact responses to email – HTML/CSS/JS

I have the following form:

/* Contact Form */

input[type=text],
[type=email],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #555;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=submit] {
  background-color: #0563bb;
  color: white;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
}

input[type=submit]:hover {
  opacity: 0.9;
}

.contactform {
  position: relative;
  border-radius: 50px;
  background-color: #f2f2f2;
  padding: 5px;
  z-index: 2;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: auto;
  margin-top: 1%;
  width: 100%;
  animation-name: gradient;
  animation-duration: 3s;
  animation-iteration-count: infinite;
}

.contactform:hover {
  animation-name: gradient;
  animation-duration: 15s;
  animation-iteration-count: infinite;
}

.column {
  float: center;
  width: 50%;
  margin-top: 6px;
  padding: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width: 600px) {
  .column,
  input[type=submit] {
    width: auto;
    margin-top: 0;
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}
<section id="contact">
  <div class="container" data-aos="fade-up">
    <div class="contactform">
      <div style="text-align:center">
        <div class="section-title">
          <h2><br/>Get In Touch</h2>
        </div>
        <p>Feel Free To Reach Out To Me Through This Form! </p>
      </div>
      <div class="row">
        <div class="column">
          <form name="myform" action="https://formspree.io/f/xdobkgny" method="POST" novalidate>
            <label for="firstname">First Name</label>
            <input type="text" id="first name" name="firstname" placeholder="Your First Name.." required>
            <label for="lastname">Last Name</label>
            <input type="text" id="lastname" name="lastname" placeholder="Your Last Name.." required>
            <label for="email">Email:</label>
            <input type="email" id="email" name="email" placeholder="Your Email.." required>
            <label for="subject">Subject</label>
            <textarea id="subject" name="subject" placeholder="Lets Collaborate.." style="height:170px" required></textarea>
            <input type="submit" value="Submit">
          </form>
        </div>
      </div>
    </div>
  </div>
</section>

This form is sending responses to the desired email, however I want to change the redirection page to thankyou.html instead of the Formspree redirection page. How would I modify this following JS code? This JS code also has some other information such as error messages…etc but I already got that covered so can I just remove that part? Essentially, the only thing I want to change is redirection on the submission and dont want any errors or any other info. The only reason I am using the JS code provided by Formspree is to change the redirection and nothing else. How would this be possible? I want to remove text such as Thanks for your submission! and Oops...... which is provided in the following JS code since I already have that covered with my own js code in my file.

JS code:

var form = document.getElementById("my-form");
    
    async function handleSubmit(event) {
      event.preventDefault();
      var status = document.getElementById("my-form-status");
      var data = new FormData(event.target);
      fetch(event.target.action, {
        method: form.method,
        body: data,
        headers: {
            'Accept': 'application/json'
        }
      }).then(response => {
        status.innerHTML = "Thanks for your submission!";
        form.reset()
      }).catch(error => {
        status.innerHTML = "Oops! There was a problem submitting your form"
      });
    }
    form.addEventListener("submit", handleSubmit)

How to use an object as an argument in JavaScript subclasses?

For example, if I have something like this:

class X{
    constructor({one, two}){
        this.one = one 
        this.two = two
    }
}

class Y extends X{
    constructor(props, three){
        super(props)
        this.three = three
    }
}

And I want to create an object with:

console.log(newY({one: 1, two: 2, three: 3}))

Is it possible? I tried other ways like:

console.log(newY({one: 1, two: 2}, 3))
console.log(newY({one: 1, two: 2}, {three: 3}))

but they are uncomfortable.

Function goes to recursive mode on submit

I am getting username and password through queryparams and showing that data in input field of php website and using javascript to show dashboard instead of login page. But website goes to recursive mode when directly calling login button function, for that i am using alert to stop for 2 seconds. Is it possible to directly get that data and show dashboard. I am new to javascript, can anyone help me out yrr. Thank you!


     echo ' Username ---> ' .$_GET['xuser_name'];
      echo ' password ---> ' .$_GET['xuser_password'];

$str .= getFormRowTextInput('xuser_name', $l['w_username'], $l['h_login_name'], '', $username, '', 255, false, false, false, '');
   
$str .= getFormRowTextInput('xuser_password', $l['w_password'], $l['h_password'], '', $password, '', 255, false, false, true, '');

$str .= '<input type="submit" name="login" id="login" value="'.$l['w_login'].'" title="'.$l['h_login_button'].'" />'.K_NEWLINE;


    <script>
    
       window.onload = function(){
                  
    document.getElementById('login').value="anuj";
      
        document.getElementById("login").onclick = async function(event) {
            event.preventDefault();
            var button = document.getElementById('login');
            await button.form.submit();
      
           var currentLocation = window.location;
           console.log("test",currentLocation.href);
             setInterval(alertFunc, 2000);
    if(!(currentLocation.href.includes("logout=1"))){
         
    } 
      return true;
    }
    document.getElementById('login').click();
     }
       
       function alertFunc() {
     alert("You are Redirected to TCEXAM")
     console.log("Clicked");
       var button = document.getElementById('login');
      button.form.submit();
     }
    
    </script>

script async custom-element=”amp-facebook-page” src=”https://cdn.ampproject.org/v0/amp-facebook-page-0.1.js”>script async custom-element=”amp-facebook-page” src=”https://cdn.ampproject.org/v0/amp-facebook-page-0.1.js”>

Reading data from .csv file in javascript

Title is self explanatory. I have no experience in JavaScript but I need to use it for this project…I am utilizing eCharts to display the data in a graph.

CSV Data (About 2000 more lines like this):

Collection Name,Rank,Volume,Change in the last 24h,Change in the last 7 days,Floor 
Price,Owners,Amount of items
The Degenaissance,50,77.96,+414.26%,+202.70%,1.44,2.3K,2.5K

I can also take out the name of the categories if necessary (like I said, I have no idea how this works).

JS-Code that I could come up with until now (pretty much just copy-pasted from echarts):

option = {
  title: {
    text: 'Stacked Line'
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
  },
  grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      name: 'Email',
      type: 'line',
      stack: 'Total',
      data: [600, 132, 101, 134, 90, 230, 210]
    },
    {
      name: 'Union Ads',
      type: 'line',
      stack: 'Total',
      data: [220, 182, 191, 234, 290, 330, 310]
    },
    {
      name: 'Video Ads',
      type: 'line',
      stack: 'Total',
      data: [150, 232, 201, 154, 190, 330, 410]
    },
    {
      name: 'Direct',
      type: 'line',
      stack: 'Total',
      data: [320, 332, 301, 334, 390, 330, 320]
    },
    {
      name: 'Search Engine',
      type: 'line',
      stack: 'Total',
      data: [820, 932, 901, 934, 1290, 1330, 1320]
    }
  ]
};

The data from the .csv should end up in series[]. Is there like a function that I can use to directly pull the data from line… and input it to the variable… ect.? Or what would be a good approach to this? Thank you so much in advance!

How to get iPhone to suggest my phone number in a form?

When I on a form and the focus is on the phone number field, iPhone will sometime suggest my phone number just above the keyboard. Like in the image below.

I am trying to implement this functionality via inputmode and type=tel,

<input type="tel" inputmode="tel" />

but my phone number doesn’t show up above the keyboard. Where as on other websites, it sometimes does.

Is there an attribute or css rule that enables this functionality?

enter image description here