Ad
Change Page And Then Change A Class
Is it possible to change a Class (by ID) after clicking a link that jumps to that page? I've page 01, and when I click a link in Page 01, I want it to jump to Page 02 and then change a Class in Page 02. Is it possible?
Ad
Answer
Actually, the post that was deleted helped me a lot :)
I used this code to get the parameter
function getParam( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
Then removed the Class and added a new one
var idPassing = getParam( 'id' );
if(idPassing == "Publicidade"){
functRemoveClassCurrent();
document.getElementById("idFilterPublicidade").className+="current";
}
Thank you all!!!
Ad
source: stackoverflow.com
Related Questions
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad