logo
down
shadow

Javascript, Jquery: get element by two attr?


Javascript, Jquery: get element by two attr?

By : Eswaraiah Manda
Date : November 22 2020, 04:01 AM
Hope this helps HTML: , Your have missed [] in the name value, it should be name="shape[]"
code :
$('#form_filter input[name="shape[]"][value=Round]').prop('checked', true);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="form_filter" action="{{ Request::fullUrl() }}" method="post">
<input type="checkbox" name="shape[]" value="Aviator">
<input type="checkbox" name="shape[]" value="Round">
<input type="checkbox" name="shape[]" value="Oval">
</form>


Share : facebook icon twitter icon
jquery finding an Element with and ID as an ATTR?

jquery finding an Element with and ID as an ATTR?


By : Matheus Santos
Date : March 29 2020, 07:55 AM
help you fix your problem Given the following: , Use the "#" selector:
code :
$("#NAV li#74").remove();
Using element attr in Javascript function

Using element attr in Javascript function


By : andrewsgunn
Date : March 29 2020, 07:55 AM
it fixes the issue There are a few things that you should change to get this working, taking Jimbo's answer and adding a few other things:
code :
var dict = {
  "dataP": "this is my p tag text"
};

$('[data-text]').each(function () {
  if ( $(this).data("text") ) {
    var dictAttr = $(this).data("text");
    if ( dictAttr && dict[dictAttr] ) {
      $(this).html( dict[dictAttr] );
    }
  }
});
<p data-text="dataP"></p>
var dictNav = $(this).data("text"); /// e.g. say dictNav == 'dict.dataP'
var ref; eval('ref='+dictNav);
if ( ref && red.substr ) {
  $(this).html( ref );
}
function navigate( obj, path ){
  var cur = obj, bits = path.split('.');
  for ( var i=0, l=bits.length; i<l && cur; i++ ) {
    cur = cur[bits[i]];
  }
  return cur;
}
var dictNav = $(this).data("text"); /// e.g. say dictNav == 'dict.dataP.test'
var ref = navigate({dict:dict}, dictNav);
if ( ref && red.substr ) {
  $(this).html( ref );
}
var dict = {
   "dataP": "this is a test",
   "forms": {
     "inputLabel": "this is a second level"
   }
};

function simplifyDict( obj, target, path, subpath ){
  if ( !target ) { target = {}; }
  if ( !path ) { path = ''; }
  for( var i in obj ) {
    subpath = (path ? path + '.' : '') + i;
    if ( typeof obj[i] == 'object' ) {
      simplifyDict( obj[i], target, subpath );
    }
    else {
      target[subpath] = obj[i];
    }
  }
  return target;
}

dict = simplifyDict( dict );
{
  "dataP" : "this is a test",
  "forms.inputLabel" : "this is a second level"
}
select an element using jquery attribute selector when attribute name is like "attr:attr"

select an element using jquery attribute selector when attribute name is like "attr:attr"


By : Polarbear90
Date : March 29 2020, 07:55 AM
hop of those help? For example, I have an svg path All I want is to select him using attribute selector, like $('path[inkscape:label*="figure"]') which is doesn't work (and as I understand, it shouldn't because ":" is reserved for something more awesome). Is there a way to bypass this without editing an svg itself? , Try escaping the : symbol?
code :
$('path[inkscape\\:label*="figure"]')
jQuery: for loop element attr change, all elements have last elements attr

jQuery: for loop element attr change, all elements have last elements attr


By : user4878684
Date : March 29 2020, 07:55 AM
Hope that helps Each time through the loop, you're cloning all the lis, giving all the clones the same rel attribute, and putting that in the HTML of #newList (replacing what was put there on the previous iteration). Instead, you should clone each one separately, and append it to #newList.
code :
$("#list li").each(function(i) {
  $(this).clone().attr('rel', i).appendTo("#newList");
});
$("#html").text($("#newList").html());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<ul id="list">
  <li>1</li>
  <li>2</li>
  <li>3</li>
  <li>4</li>
</ul>

<ul id="newList">

</ul>
<br>newList HTML:
<div id="html"></div>
Extract & call JavaScript function defined in the onclick HTML attribute of an element(using jQuery attr/prop)

Extract & call JavaScript function defined in the onclick HTML attribute of an element(using jQuery attr/prop)


By : androider
Date : March 29 2020, 07:55 AM
wish of those help You can do it like this, i.e. use attr instead of prop to get the string value of b's onclick, afterwards replace the arguments p,q from the string with p,q,r and then use Function constructor to create an anonymous function with the new body (after replace).
code :
jQuery('#btn_a').on('click', function(){
    var onclickB = jQuery('#btn_b').attr('onclick'),
        onclickA = Function(onclickB.replace("p,q", "p,q,r"));
    return onclickA();
});
Related Posts Related Posts :
  • Knockout JS: adding forms in foreach bindings
  • HTML5 Canvas positioning mouse clicking broken
  • JQuery on change fired only after second change of select box
  • Unable to limit WebRTC P2P Multi-participant Receiving Bandwidth
  • What is the RegEx to just return the last part of the URL
  • State Remains Undefined in React
  • removing content on website before a screen reader can read it with either JavaScript or CSS...?
  • on 'click' firing before click
  • Manipulation of an array sent by ajax to a php file, within a function of another file
  • How to use plunker or jsfiddle to run angular2 code
  • JavaScript lexical environments as objects
  • Iteratively position spheres with DOM pixels using three.js and React
  • React trying to access file at a wrong path
  • AES encryption in JS equivalent of C#
  • Filter an Array based off user input string and menu dropdown items
  • Constantly read local file with JS?
  • React navbar handler with theme
  • Show changes to HTML5 canvas immediately
  • Tooltip Stays Hidden In D3 Treemap
  • Backbone - What is the best way to listen to 2 models?
  • formatting an array of objects output
  • Bind input value to specific value in object
  • Animation doesnt work when onClick event occurs (react.js)
  • Consume enum from ambient TypeScript module using @babel/preset-typescript?
  • Changing order of React components only triggers re-render after second click
  • Track the total time the HTMLAudio was playing
  • Call javascript function in PHP file and load html file after?
  • Theme Development: JavaScript not working when linked from functions.php
  • Add attributes to multiple <td> in datatables
  • Progressive loading codesnip not quite understood
  • How to format default date in javascript?
  • Caesar cipher only gets first value right
  • innerText not showing after setting it straight after creating the element
  • How to use HTML template tag with jQuery?
  • Showing v-menue's selected option in another part of the application. Vuetify
  • How can I find and return my div element with rails and javascript?
  • The right way to use Ajax to Update a Single field in a specific Object
  • Hhow to create a react element and apply a javascript method to it
  • Change src of parent window iframe
  • How do you bind a style attribute if data is true?
  • JavaScript TypeError: Cannot read property 'id' of undefined
  • Use font-face with webpack encore
  • Best way to replace all characters from left to right?
  • Update React component with javascript
  • How to make a get route like "router.get('/region/:id')" but with a limited range for the id?
  • Attribute Value in Javascript
  • Add new property to object collection based on condition with lodash
  • Transforming an object with a javascript class
  • Why does the hash compare outputs true even without the salt parameter?
  • Moment.js comparison always returns false
  • Store polygon type of data on the `SQLite` database
  • Matching data depending on chosen preferences
  • issue which is related to vuex store + cookies
  • Order By custom order in object inside property
  • How to display a preselected value in a dropdown without 'onchange'
  • Storing a javascript promise
  • Replacing text in nested divs
  • Strange behavior with select list options when adding and removing tasks using javascript
  • NodeJS Ajv module alway log message ' $ref: keywords ignored in schema at path "#" '
  • How to create TTL Index on long timestamp in MongoDB
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org