ZulfadlyAshBurn Posted June 9, 2011 Share Posted June 9, 2011 I am just wondering if it is possible to make your own tags to the input function such as <input type="button" value="Button" mytag="LOL"/> if its possible, tell me how is works. Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/ Share on other sites More sharing options...
trq Posted June 9, 2011 Share Posted June 9, 2011 HTML5 allows custom data attributes, there basically a place to store extra data relating to an element. This data can then be selected and used within JavaScript. See here Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227343 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 9, 2011 Author Share Posted June 9, 2011 Thanks alot thorpe. Nice working with you guys Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227349 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 9, 2011 Author Share Posted June 9, 2011 one more thing. is it possible if someone clicks the div, the data attr gets called out and the functions then executed. Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227353 Share on other sites More sharing options...
trq Posted June 9, 2011 Share Posted June 9, 2011 Sorry, what exactly do you mean? Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227366 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 9, 2011 Author Share Posted June 9, 2011 So example i have a div <div id="mydiv"></div> i add a data attr to it. <div id="mydiv" data-url="http://google.com"></div> as you can see, the data have a url in it. I would like it to go to google.com if the div is clicked. how do i do it with the javascript currently the code i have <script> function redirect() { var tdiv = getElementbyId('mydiv'); var rurl = tdiv.getAttribute('url'); location.href = rurl ; } Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227373 Share on other sites More sharing options...
ZulfadlyAshBurn Posted June 9, 2011 Author Share Posted June 9, 2011 nvm, ive got the onready function by jquery. next, is it possible to create your own tags such as <div> <p><h1> Quote Link to comment https://forums.phpfreaks.com/topic/238862-help/#findComment-1227385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.