score:1
Accepted answer
Working demo http://jsfiddle.net/DDv8U/
- API: http://api.jquery.com/data/ - try using this
$(div).data('name', ' - Testing 2');
rest should fit the need :)
code
$(function(){
var div = $('div');
$(div).append($(div).data('name'));
$(div).data('name', ' - Testing 2');
$(div).append($(div).data('name'));
});
score:2
You are changing the attribute but this doesn't automatically update the data. This works:
$(function(){
var div = $('div');
div.append(div.data('name'));
div.data('name', ' - Testing 2');
div.append(div.data('name'));
});
Related Query
- How to sum all input values in the DOM with a specific data attribute using jquery
- JQuery - Toggle Elements based on data attribute with the same class
- Create a tab system with html data attribute and jquery based on the value of the data
- Show the JSON data in the new HTML tab using jQuery
- jQuery get() request retrieves data before the new data has been submitted
- Setting data attribute to button and chainging the value of said attr jquery
- How can i give data attribute variable inside the double quotes using Jquery
- jQuery switching the value of Data Attribute
- Jquery Data function returns undefined value when an element is explicitly named in the paremeters
- Is it possible to add new table attribute with serverside data in Jquery datatable
- the new data from a later time to replace the current one in jQuery
- How to get the value of data attribute using JQuery in asp.net core?
- jQuery - element is selected by attribute but the index returns value of the elements without attribute
- Change the "src" attribute keeping the initial size , with JQuery
- how should i use the jquery code to do to that ? (add attribute on Colon style tag)
- Jquery attribute equals selector only selects the first element
- jQuery :selected always returns the first option
- What is the best way to load new javascript file after jQuery post?
- jquery doesnt seem to load when i call the page using ajax
- jquery get responseText undefined yet web inspector shows xhr object with data and in inspector it also shows response text for the object
- I Cannot match Jquery Ajax data string from the server
- How to float divs top to bottom with jQuery like the new layout for myspace.com?
- How to display the data in multiple list items in listview using jquery
- How to point onclick event on a specific table row content using the id of the row and rel attribute of link - jQuery
- Regular expressions: transferring the data attribute
- Changing the data attribute of object tag to an SVG File
- Custom jquery plugin doesnt print name of the element if it is clicked
- I want to convert html table DATA to pdf and download it using jquery the code is as below
- Bind the new data source without re-initializing kendo grid which was already initialized
- Jeditable jQuery - Add data attribute to input after init
- Will google bot read the data which are fetched via jquery event -doucument.ready
- Twitter search API using jQuery and Ajax - How do I retrieve the data as my demo shows no results
- I need to pullback data from a jquery ajax post and break the array out to seperate outputs
- processing some github participation data with YQL,flot & jquery but the JSON isn't cooperating
- jQuery Sortable - using an element's data as the attribute?
- How to upload a file through jQuery or AJAX with text data and save the file name in to SQL database?
- Jquery $.post is returning the wrong data
- jQuery Mobile Popup and ListView, and Knockout.js Data Binding Inside the Popup div - Not Working
- jquery mobile listview data only display when touch on the screen in Android (Samsung Galaxy Note)
- Unable to retrieve the data from ckeditor jquery plugin
- jQuery | Assistance needed with listview and passing data when clicked to a new page
- returns attribute undefined in jquery
- Jquery ajax Select Radio, check boxes and drop downs depending on the data retrived from database?
- Jquery dialog on submit returns Json data in white viewport
- Jquery form validate returns the error message of the last element
- JQuery Full Calendar with Spring MVC .. Can't send the calendar data to the controller
- How to display the data base values order by date using jquery here?
- jquery mobile - are data roles inherited on the same tags?
- jQuery : event.which returns different codes when a number is pressed from numpad and when from the numbers keys above alphabets
- jquery autocomplete reload the data
More Query from same tag
- Pinterest hover buttons
- How to open and close a div if its clicked on Twice
- Showing and hiding previous and next elements in a class
- If Then Select From List
- How to save a variable to the server using jQuery
- how to encode json.stringified output
- jQuery fadeout woes
- Display different <h1> text on interval
- Display Data one at a time using Jquery
- Cant find a button after ajax load
- HTML tag <a> Both href and onclick
- Form input with empty value
- SyntaxError: missing : after property id when html file inspection
- click a link is not working after changing html simple code on jsfiddle.net
- How to add alternate colors to a table body(tbody) using css?
- Fit to box with two images
- form validaiton on form submit without page reload
- how to use http://randomuser.me/
- Check the selected class in jQuery
- fadeout effect with hide in jquery
- Cannot get jQuery UI Sortable to work properly
- jQuery dynamic form hide button remove for last form input
- jquery lib is not including
- How do I make rounded Jquery UI tooltips?
- How to manipulate scroll event in CodeMirror?
- Delete array object when value is empty
- jQuery expand/collapse TR in table with click
- jQuery.load in Opera 10.6 not firing complete
- Make the output of a span the value of an input
- How to get jQuery to recognize mouse over image once per hover