Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    3,100

    Custom attributes for HTML tags

    In administration interfaces for my sites I sometimes do things like this
    Code:
    <select onchange="roughMeUp(this)">
    <option value="some value" attribute1="blah" rawdata="blah2">This is blah</option>
    </select>
    function roughMeUp() could look like this

    Code:
    function roughMeUp(obj){
     var opt = obj.options[obj.selectedIndex] 
     alert (opt.getAttribute('attribute1') + ' ' +opt.getAttribute('rawdata')  )
    }
    Now I am thinking about using this for public sites too. I am wondering if there is any good reason not to use custom attributes for HTML tags. Comments ?

  2. #2
    Join Date
    May 2005
    Location
    Planet Earth
    Posts
    813
    Never saw anything like that. I will surely look forward into using this 'custom hack'.

    Thanks,

    G
    PutFile.io Disrupting traditional file hosting.
    █ Signup Early and enjoy Unlimited space/bandwidth for your files hosting, Forever!
    █ No Ads.
    █ No Countdowns.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •