The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript while adding class to diffrents classes it make all the same

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #194795

    hello every body here

    when i trying to add Common class to multiple divs , each div contains link inside divs have differents classes by this way

    var setclass=”class=’common-class'”;

    <#div ‘+setclass+’>
    <#a href=”>google<#/a>
    <#div ‘+setclass+’>
    <#a href=”>facebook<#/a>
    <#div ‘+setclass+’>
    <#a href=”>youtube<#/a>

    then when i set attr value to this classes


    now the problem is : all classes abov have href=’;


    Create a reduced test case in and it’ll be a lot more clear to us what’s going wrong.

    In your example above, I don’t see any code where you assign the classes “class1”, “class2” and “class3”, and I’m not sure why every DIV starts with a pound/hashtag.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.