the following is my HTML DOM element...
<input type="text" style="width: 200px;" id="input1"/>
I want to keep the date value in it..But somewhere i need to specify that it is going to hold date ... |
I have a colection of checkboxes with generated ids and for a reason, some have an extra attribute. Is possible using JQuery to check if an element has a specific attribut ... |
I'm trying to select a series of divs one at a time. I'm sure theres a better way to do this, but I gave them all unique rels and I'm ... |
I am new to javascript in general and pretty much have no idea what is going on. Sorry for the super noobie question.
I have an accordion being started with the following ... |
I'm working on separating JavaScript code from my HTML. I currently have code that looks like this:
<div onclick="return do_something_with('100566');" class="clickable">Click Me!</div>
I'd like to swap the onclick to an attribute containing just ... |
I am looking at the custom attributes feature of html 5 here at this link
http://ejohn.org/blog/html-5-data-attributes/
This look like the perfect thing for when I am using jquery/javascript. ... |
I'm trying to write an if statement where if one of the elements has it's display set to "none", I want the parent element to also display "none"...
This is ... |
|
is there a way to get the list of attributes set to an element?
example:
<div id="myID" title="I am Title" myAttr="I am something else">Hello World!!!</div>
is there a way to get all the ... |
Suppose I have these divs:
<div class="hat" rel="cap">
<div class="hat" rel="pine">
<div class="hat" rel="mouse">
How do I use JQuery to do a "where"?
For example
$("div.hat").remove WHERE rel="mouse"
|
Is it possible to refer to an attribute of an element conditionally with Jquery?
What I'm after is something like:
$(".mylink":rel["2"]).show();
... which would "show the specific instance of .mylink element on the page ... |
I'm trying to get the source attribute of all images withing a specific div but somehow it keeps telling me that the function .attr() doesn't exist...
That's the function. Firebug also tells ... |
I have the following function which limits the amount of characters you can enter into a text area.
What's meant to happen is, if the text length is higher than the text ... |
Is there any difference between $(".selector").size() and $(".selector").length ?
|
How can I get attributes values from an container using jquery ?
For example:
I have container div as:
<div id = "zone-2fPromotion-2f" class = "promotion">
here how can I get attribute id value using ... |
I'm looking for a way to grab the custom attributes of a element with jquery.
<span id='element' data-type='foo' data-sort='bar'></span>
I'm looking to get: ["data-type", "data-sort"] as an array.
Anyone know how to do this?
Thanks.
... |
There are many class="item" blocks on the page.
For each one there is different var item_link and ajax request.
Ajax searches for src attribute of .message img and throws it to var src.
$(".item").each(function(){
...
|
In my application, I need to calculate the size of the file in client side (before uploading to server).
I want to restrict the file being uploaded if it doesn't ... |
can someone help me with jquery. i have a html TAG like this
<p class="celak">hohohohoho</p>
and i want to make the output (give its parent) be like this
<div class="celak-parent"><p class="celak">hohohohoho</p></div>
is there somebody know ... |
I am trying to select an element in the list depending on its html content. I was hoping to do something like $('li[html="something"]'), but of course html isn't an attribute. Is ... |
Here's my problem: Consider the following html:
<div id="item1" class="green_large">
<div id="item2" class="green_large">
<div id="item2" class="green_small">
<div id="item4" class="yellow_large">
<div id="item5" class="yellow_large">
How do I check if $(this) contain a class name with the substring "yellow" for ... |
I'm trying to write a simple placeholder jQuery plugin for a site of mine but of course I only want to fire the function if the native placeholder attribute isn't supported…
How ... |
I want to associate some custom data with some HTML nodes. I was going to use the new HTML5 style 'data-*' attributes. e.g.: <tr class="foo" data-typeid="7">…, and then I was going ... |
Currently I am using java servlets to set up Hashmaps, lists, and range of business objects and then pass them to a jsp page via request.setAttribute("myMap", myMap);
How can I directly access ... |
Why does this not work? (http://jsfiddle.net/J8n2g/):
$('body')
.append($('<img>')
.attr({
'src': 'http://www.google.com/intl/en_ALL/images/logo.gif',
'width': '100%', 'height': '100%' })
.hide()
.load(function() { $(this).show(); ...
|
Suppose I have the following HTML:
<img id="foo" src="bar1.jpg"/>
I would like to switch the src to bar2.jpg
Can I just do this?
$("#foo").attr("src", "bar2.jpg");
Or do I have to do this?
$("#foo").removeAttr("src");
$("#foo").attr("src", "bar2.jpg");
Thanks!
|
I want to refresh the output of the script below. Is this json? Do I need to add a crossdomain policy in my site?
<div id="nowplaying">
<script src="http://s4.total-streaming.com/xml.php?station=1269&get=js"></script>
</div>
Edit:
This is ... |
Either I have misunderstood the jQuery docs for .attr(), or I'm making a very stupid error.
Why isn't this working?
<div id="mydiv" title="mytitle"></div>
<script type="text/javascript">
$(document).ready(function(){
var username ...
|
I am using jQuery and in order to perform dynamic computations I need to store some information along an anchor tag, such as:
<a href="blah.html" username="some value" age="12" address="blah">click</a>
Of course this code ... |
<input type="file" id="file-id" />
<input type="text" name="file_path" id="file-path">
in jquery:
$("#file-path").val($("#file-id").val());
gives me : - 'C:\\fakepath\\test.py'
I am using ubuntu as my operating system. If I selected a file from /home/mylappy/Document/test.py It shows me the file ... |
I have a form which has many elements (e.g. textarea, input, select), after users have entered some data the states of these elements should change.
For example, an input[type="radio"] element will have ... |
I have a website in which I am including a javascript file from this link:
Code Snippet Page
I am getting this error: Microsoft JScript runtime error: Object expected
Here is my ... |
I'm working on some form UI coding and wrote this jQuery one-liner:
$('input[type=text]').val($(this).attr('default-value'));
Intention is to give every input text field its default value which is supplied within an attribute.
Any suggestions?
TIA
... |
I want to check if the element I click (this) has a specific attribute, as a condition in the if clause.
Is it possible to do this with JavaScript or jQuery?
Thanks
|
I have the following HTML
<input type="text" name="first" expression="firstExpression"/>
<input type="text" name="last" expression="secondExpression"/>
<input type="text" name="age" expression="thirdExpression"/>
I have a custom expression attribute.
I using jQuery to iterate over all the input ... |
<input id="mnc" type="text"/>
<input type="text" id="selected" />
$('#mnc').val().length ? $('#selected').attr({
'size': $('#mnc').val()
}) : $('#selected').removeAttr('size');
This gives an error in Firefox 4.
Index or size is negative or greater
... |
I am using this jQuery star rating plugin and I would like to get the name of the star that I clicked. The code can be fiddled |
I use a webkit dot net browser through c#, and I have a website that I am showing through that browser in a desktop application. Anyway, I came to ... |
I love using the hide() and show() methods, but I've come across someone's scripting where they never use it.
Instead I see them using attr() for anything related to display.
$("#element").attr("style", "visibility:hidden");
$("#element").attr("style", ...
|
I use the jQuery html Attributes to wrap some words in a large piece of text, this works fine but if the text has some html tags in it, it will ... |
I am trying to change the font-weight of an element. I tried with the following but it doesn't seem to work:
$("#opt_" + i).attr("font-weight", "bold");
Also what's the difference between prop and attr? ... |
I am trying to set some attributes on HTML snippets. The purpose is to repopulate a form with previous inputed values. I set attributes with .attr() but after I do a ... |
is it possible to create a identification attribute sort of a class or an id and assign it in jQuery selector with special character?
for example I want an "identity" attribute to ... |
I've got the following field on an MVC view:
@Html.TextBoxFor(model => model.Course.Title, new { data_helptext = "Old Text" })</span>
In a seperate js file, I want to set the data-helptext attribute to a ... |
I'm trying to set the attribute of an element programmatically, but firebug keeps giving the error: obj.setAttribute is not a function. I'm using jQuery so I'm going to show a bit ... |
I'm thinking of a way to reduce the amount of javascript code by enabling ajax on links from attributes. Example:
<a href="/Default/Link.html" data-endpoint="/Ajax/Link.html" rel="targetId" async="true">Click me!</a>
async="true" will disable default behaviour of the ... |
I have an issue I have this jQuery code:
$(document).ready(function(){
$("#follow").click(function(){
...
|
I have no idea if I just found a potential jQuery bug, but check out the following case.
If I'm dynamically changing a data-ajax-link attribute and then try to get it's value ... |
using jQuery, I'm trying to see if a random id ends with a certain string using the following pseudo code:
var node = $('#foobar');
if (node.attr('id').endsWith('bar')) {
// do stuff
}
I know for node ... |
I'm trying to get the id of a table using a table row. While I am in a loop:
$(this).parent.attr('id');
However I am getting an error. Is my syntax right?
Thanks.
EDIT:
<table id="21-rawTable" border="1"><tbody><tr class="even ...
|
Here's what I'm thinking about doing. using a data-track attribute in links and buttons that would contain data I want to send to Mixpanel... Something like:
click it
Then somehow jQuery bind to ... |
This is working when using images:
$("#div).attr('onClick', 'return hs.expand(this)');
This is not when using ajaxed content:
$("#div").attr('onClick', 'return hs.htmlExpand(this, { objectType: 'ajax'} )');
Probably there is something wrong with the syntax.
|
I am dynamically creating HTML items using jQuery. Though items are dynamically created but their attributes are note. I mean if I assign class and id in the $() call, the ... |
I am often needing to store little pieces of reference in a page element, most of the time a <div>. I couldn't find too much documentation on how valid it would ... |
I have this button:
<button type="button" class="themeChanger" data-themeValue="grid" value="Grid">
<img src="templateImages/Icon_200.png" />
</button>
And this jQuery:
$(".themeChanger").click(function ...
|
Trying to create a link dynamically for some purpose
$('', {
text: 'Click here!',
href: 'http://www.example.com',
title: 'Click to win'
}).appendTo('body');
But this is not ... |
I've been adding custom attributes which I reference using JQuery, this works great. But is it good practice?
example:
<div class="monkeys" customattr="big Monkey"> </div>
thanks all
|
(Please disregard any security concerns you may have with this approach, I have a already taken more than enough precautions to make sure that there are no blatant vulnerabilities with this ... |
i have this html.
<img src="2.png" alt="Pending" data-number="00991" data-status="0">
i am using the following jQuery to fetch the value.
var number = $(this).find('img').data('number');
above jQuery code fetches values with non-leading zeros, for example the above ... |
Is it possible, to access a widget's attributes in jQuery, like in Dojo?
dijit.byId('#controlDiv').attr('text');
|
I want to cancel any links and add extra attributes to each one. Below is how I've achieved this.
function anularEnlaces(){
$('nav a').each(function(){
...
|
This is the anchor that MVC 2 is creating:
<a class="syncLink" data-resultstarget="OmsToAdminPzInfoSyncResult"
href="/Sync/OmsToAdminPzInfoAjax"
onclick="Sys.Mvc.AsyncHyperlink.handleClick(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, updateTargetId: 'OmsToAdminPzInfoSyncResult' });">
Pz ...
|
|
|
|
|
Not sure if the problem is you trying to set the id to an invalid string (an id must start with a lowercase letter). I'm sure you have declared the variable "l" so you know what it is from start. The string you have as a parameter in the clone method doesn't do anything. |
I understood the jQuery documentation for 1.6.1 to say that the data-camel-casing will be converted to data('camelCasing'). Given this, is seemed logical going forward that it would be better to use this nomenclature for our attribute names, so I created a test page and changed one of our attribute names from "data-rec-ed" to "data-recEd". |
|
I am having an issue with retrieving the attribute of an element that I have ajax'ed into my site, the following is the code that brings it in: $('a[rel=newpoint]').live('click', function() { jQuery.facebox(function(){ ... |
|
|
|
I have a number of inputs (chk_0, chk_1 ,....) residing each in their own div. When an input is clicked I need to reverse the "checked" value for that particular checkbox input . However I cannot find the right syntax to do that : Creating the inputs $('#mydiv' + i).addClass('labelForStyler') // add class for divs ... |
|
I want to be able to assign a tooltip to these elements that will pass the amount value (10) to an ajax to calculate the taxes for the logged in user and display it in the tooltip. I have this working fantastically, but again - the amount attribute is no valid html if we want to validate strictly. |
|
Hi ,I'm making a ajax call using $.ajaxmy code is$.ajax({ type: "POST", url: "sample.php", dataType:"html", data: "name="+$('#name').val(), success: function(msg){ $('#result').append(msg); } });And the response isUser1When i try to get the Id from the response, it's seems not working..$('.user-link').click(function(){alert($(this).attr('id'));});And i need to make this work urgently...Any help will be greatly appreciated...Thanks in advance... |
I was wondering what jQuery uses these attributes for inserted into the anchor tags (i.e. jQuery1250190927174="40")? I am able to modify the code using IE Developer Tools. On the links, I get a referrer if I remove the jQuery attribute (which is inserted dynamically) from the anchor tags. Example below: So what's the purpose of this ... |
One issue I ran across while learning jquery was that I often wanted/needed a way to tell jquery to get data for the current element from arelated element. jQuery immediately tends to be friendly when you needto work with a class of elements via the CLASS attribute, or aspecific element via the ID attribute. However, when there are 2elements that are ... |
All,I have a situation where I need to pass the same named attribute to anAJAX enabled endpoint. Basically I need to simulate something likehttp://example/cgi?text=1500characters&text=1500characters. I needthis type of scenario to work in typical JQuery AJAX and JSONP calls.I understand that I may run into browser/server URL limitations.In case anyone is wondering, Im AJAX enabling some old PL/SQL codeusing Oracle's Webtoolkit and ... |
I was wondering what jquery developers opinion of adding customattributes to html tags is, and what your basis is for theseopinions? Why is it a good idea, or why is it a bad idea? What Imean is this: content where 'myType' isn't in any specifications. I've run into developerswho think this is a good idea, and those who think this is ... |
[jQuery] getting data using html attribute in Using jQuery 2 years ago Hi,i have several html tags with some additional attributes like 'type' or 'abbr'. for example :<thid="col_1"class="ColumnHeader"align="center"abbr="language" |
Hallo all: I got this piece of code:$("#faq").click(function () { var url = $.get("faq", { pagina: "page" }); alert(url);});On "faq" responds a Servlet tha set an attribute on the request ....request.setAttribute("pageFAQ", pageFAQ); ....After the get jqeury print me [object XmlHttpRequest I would like toaccess to the attribute setted in the Servlet but I dunno how to do.Any idea?Kind regardsMassimo UGues |
|
|
The aim of the metadata plugin is accessing data form HTML5 data attributes. My suggestion is to use data-control attribute as a standard way to add jquery controls to html tags, and make it as a standard part of jquery core. It is something like Dojo's dojotype, or Entourage's (http://doc.appcelerator.org/ui:start) control attribute. It is only a small thing (yes, you can ... |
|
Hi ,I'm making a ajax call using $.ajaxmy code is$.ajax({ type: "POST", url: "sample.php", dataType:"html", data: "name="+$('#name').val(), success: function(msg){ $('#result').append(msg); } });And the response isUser1When i try to get the Id from the response, it's seems not working..$('.user-link').click(function(){alert($(this).attr('id'));});And i need to make this work urgently...Any help will be greatly appreciated...Thanks in advance... |
Wouldn't it be better to toggle between the first and the second class, rather than limiting it to replacing the first with the second? $.fn.swapClass = function(c1, c2) { return this.each(function() { var $this = $(this); if ( $this.hasClass(c1) ) $this.removeClass(c1).addClass(c2); else if ( ... |