You can add attributes using attr
like so:
$('#someid').attr('name', 'value');
However, for DOM properties like checked
, disabled
and readonly
, the proper way to do this (as of JQuery 1.6) is to use prop
.
$('#someid').prop('disabled', true);
Related Posts:
- What is the difference between HTML tags and ?
- Automatically pausing html5 video as the ‘next’ button is pressed (javascript/ jquery)
- Get the value in an input text box
- jQuery.addClass not working
- Get checkbox value in jQuery
- How to make a simple modal pop up form using jquery and html?
- Bootstrap throws Uncaught Error: Bootstrap’s JavaScript requires jQuery
- jQuery Scroll to Div
- jQuery checkbox event handling
- jquery – how to show a hidden div
- How to scroll to top of a div using jQuery?
- Stray end tag “head”
- Check if a div exists with jquery
- Find out whether radio button is checked with JQuery?
- JQuery: ‘Uncaught TypeError: Illegal invocation’ at ajax request – several elements
- jquery ajax function not working
- jQuery find element by data attribute value
- Scroll to bottom of Div on page load (jQuery)
- CSS calc width and height values
- HTML encoding issues – “” character showing up instead of ” “
- Center image using text-align center?
- CSS Background Opacity [duplicate]
- How to create an HTML button that acts like a link
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- How to get a tab character?
- How to make JavaScript execute after page load?
- Is there an upside down caret character?
- Prevent line-break of span element
- How to run python script in HTML?
- Set the table column width constant regardless of the amount of text in its cells?
- CSS Display an Image Resized and Cropped
- How do I make a placeholder for a ‘select’ box?
- Javascript: getElementById vs getElementsById (both works on different pages)
- CSS: background-color only inside the margin
- Stretch background image css?
- Set cellpadding and cellspacing in CSS?
- WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for ‘jquery’. Please add a ScriptResourceMapping named jquery(case-sensitive)
- Disable Scrolling on Body
- CSS Background Image Not Displaying
- Changing image sizes proportionally using CSS
- How to give the background-image path in CSS?
- How to overlay image with color in CSS?
- CSS Background image not loading
- Outline radius?
- Bootstrap Dropdown menu is not working
- Bootstrap Dropdown menu is not working
- right align an image using CSS HTML
- CSS Background Image Not Displaying
- Show/hide ‘div’ using JavaScript
- Why is this HTML5 document invalid?
- Play an audio file using jQuery when a button is clicked
- Check a radio button with javascript
- How do you give iframe 100% height
- bootstrap 3 navbar collapse button not working
- HTML Display Current date
- Error: The requested URL “[no URL]”, is invalid
- Is it possible to set the equivalent of a src attribute of an img tag in CSS?
- Why is colspan not applied as expected
- Document Root PHP
- How to display a gif fullscreen for a webpage background?
- Padding a table row
- Clearing my form inputs after submission
- Reload an iframe with jQuery
- How to create spoiler text?
- jQuery scrollTop() method not working
- FormData append not working
- How do I horizontally center a table in Bootstrap
- How do I center text in a span?
- text-align justify not working
- Best way to center a
on a page vertically and horizontally?- How to resize an image to fit in the browser window?
- HTML / CSS table with GRIDLINES
- How to embed a Google Drive folder in a website
- Pure HTML Back Button
- How to access and download a file from a server using HTML 5
- Display text on MouseOver for image in html
- Layout a flex box similar to a table?
- html : iframe not showing content in html
- How can I capture the right-click event in JavaScript?
- How can I publish Word files to a WordPress blog without losing the footnotes?
- Remove html markup by wordpress
- How can I set different html lang attribute for different countries?
- Disable stored tags queries in admin page when posting a new post
- Ajaxify This Code
- Add Attribute to p Tag of Post Content
- Can’t save any WordPress post with the html tag in it
- remove string: ‘custom content…’ from every page
- How to disable escaping html chars in wordpress?
- Whitespace Before Doctype
- html entities occur in the_excerpt used as meta description
- Insert data through a script directly in the db
- How to use JQuery Marquee in WordPress?
- Use Mail-Tag from Contac Form 7 in a script
- Line break before headings () appears from nowhere
- standard callback function for wp_list_comments
- How to replace a specific html tag in bulk?
- Inserting code into a page just shows raw HTML
- Possible jquery / library conflict in plugin usage
- change the icon of a custom post type in WordPress to use twitter boostrap
- How can I insert a disclaimer in a WordPress site?