Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> JavaScript

AngularJS और HTML5 वाली सूची में टेक्स्ट इनपुट पर फ़ोकस कैसे सेट करें?

<घंटा/>

किसी सूची में टेक्स्ट इनपुट पर फ़ोकस सेट करने के लिए, निम्न कोड आज़माएँ:

newApp.directive('focus', function () {
   return function (scope, element, attrs) {
      attrs.$observe('focus', function (newValue) {
         newValue === 'true' && element[0].focus();
      });
   }
});

निम्नलिखित एचटीएमएल है:

<input type="text" ng-model="cues[$index].text" focus="{{cue.isNewest}}"
class="input-xlarge" />{{cue.isNewest}}

  1. CSS और JavaScript के साथ टू-डू लिस्ट कैसे बनाएं? CSS और JavaScript के साथ टू-डू लिस्ट कैसे बनाएं?

    सीएसएस और जावास्क्रिप्ट के साथ एक टू-डू सूची बनाने के लिए, कोड इस प्रकार है - उदाहरण <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    ht

  1. जावास्क्रिप्ट के साथ  strong  टैग में टेक्स्ट कैसे सेट करें? जावास्क्रिप्ट के साथ <strong> टैग में टेक्स्ट कैसे सेट करें?

    सबसे पहले, तत्व - . सेट करें <strong id="strongDemo">Replace This strong tag</strong> ऊपर सेट की गई आईडी विशेषता # - . का उपयोग करके टेक्स्ट सेट करने के लिए उपयोग की जाएगी $(document).ready(function(){    $("#strongDemo").html("Actual value of 5+10 is

  1. सीएसएस के साथ फोकस पर इनपुट फ़ील्ड को कैसे साफ़ करें? सीएसएस के साथ फोकस पर इनपुट फ़ील्ड को कैसे साफ़ करें?

    निम्नलिखित कोड है फोकस पर इनपुट फ़ील्ड को साफ़ करने के लिए - उदाहरण <!DOCTYPE html> <html> <head> <h1>Clearing an input field on focus example</h1> <input type="text" onfocus="this.value=''" value="Some random text..."> <h2